Posted By

sveggiani on 01/05/09


Tagged

strings evFunctions


Versions (?)

evDateToSQL | returns an SQL formated date from a given date


 / Published in: PHP
 

you can specify the source date format with the third parameter

  1. // name: evDateToSQL
  2. // version: v0.1
  3. // description: devuelve un string para sql
  4.  
  5. function evDateToSQL( $date, $separator = '/', $lang = null ) {
  6. $dateTemp = explode( $separator, $date );
  7. switch ( $lang ) :
  8. case 'es' :
  9. $dateConv = $dateTemp[2] . '-' . $dateTemp[1] . '-' . $dateTemp[0];
  10. break
  11. default :
  12. $dateConv = $dateTemp[2] . '-' . $dateTemp[0] . '-' . $dateTemp[1];
  13. break
  14. endswitch;
  15. return $dateConv;
  16. }

Report this snippet  

You need to login to post a comment.