Return to Snippet

Revision: 10591
at January 5, 2009 09:55 by sveggiani


Initial Code
// name:       evDateToSQL
// version:	v0.1
// description: devuelve un string para sql

	function evDateToSQL( $date, $separator = '/', $lang = null ) {
		$dateTemp = explode( $separator, $date );
		switch ( $lang ) :
			case 'es' :
				$dateConv = $dateTemp[2] . '-' . $dateTemp[1] . '-' . $dateTemp[0];
				break
			default :
				$dateConv = $dateTemp[2] . '-' . $dateTemp[0] . '-' . $dateTemp[1];
				break
		endswitch;
  	return $dateConv;
	}

Initial URL

                                

Initial Description
you can specify the source date format with the third parameter

Initial Title
evDateToSQL | returns an SQL formated date from a given date

Initial Tags

                                

Initial Language
PHP