convert into a mysql dae format

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

convert into a mysql dae format

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

Post by pelegk2 »

10X:)
leenoble_uk
Forum Contributor
Posts: 108
Joined: Fri May 03, 2002 10:33 am
Location: Cheshire
Contact:

Post by leenoble_uk »

You can put the timestamp straight into mysql:

Code: Select all

SET time_holding_column = UNIX_TIMESTAMP('$timestamp');
Post Reply