Page 1 of 1

convert into a mysql dae format

Posted: Sun May 16, 2004 8:31 am
by pelegk2
i am reciving this format of date :
16.05.04
(dd.mm.yy)
and i want to convert it into mysql date type
how do i do that?
htnaks in advance
Peleg

Posted: Sun May 16, 2004 12:17 pm
by feyd

Code: Select all

$inDate = "16.05.04";
$bits = explode(".",$inDate);
$timestamp = mktime(0,0,0,$bits[1],$bits[0],$bits[2]);
$date = date("Y-m-d",$timestamp);
untested

Posted: Mon May 17, 2004 1:38 am
by pelegk2
10X:)

Posted: Mon May 17, 2004 3:04 am
by leenoble_uk
You can put the timestamp straight into mysql:

Code: Select all

SET time_holding_column = UNIX_TIMESTAMP('$timestamp');