Posted By

depmed on 08/06/07


Tagged

mysql date


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

Nix
vali29


Transform MM/DD/YYYY to SQL date format


 / Published in: PHP
 

  1. /* Go from MM/DD/YYYY form input to YYYY-MM-DD */
  2.  
  3. $dateArray=explode('/',$_POST[theInputDate]);
  4. $date = $dateStartArray[2]."-".$dateStartArray[0]."-".$dateStartArray[1];

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: tylerhall on August 6, 2007

Or use this...

date("Y-m-d", strtotime($date));

Posted By: depmed on August 29, 2007

'doh!

You need to login to post a comment.