Posted By

munkypot on 03/06/11


Tagged


Versions (?)

PHP - MySQL Date Conversion


 / Published in: PHP
 

  1. // From MySQL (YYYY-MM-DD) to European (DD/MM/YYYY)
  2. $mysql_date = '2011-12-26';
  3. $euro_date = date('d/m/Y', strtotime($mysql_date));
  4.  
  5. // From European (DD/MM/YYYY) to MySQL (YYYY-MM-DD)
  6. $euro_date = '26/12/2011';
  7. list($d,$m,$y) = explode('/',$euro_date);
  8. $mysql_date = "$y-$m-$d";

Report this snippet  

You need to login to post a comment.