Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert freindly date and time to mysql format 1

Status
Not open for further replies.

pushyr

Programmer
Jul 2, 2007
159
GB
is there a simple way to convert a friendly date and time to a mysql format

my date and time looks like this...
Tue, 31 Jul 2012 13:17:23 GMT

and i'd like to both split and convert into this...

1. 2012-07-31
2. 13:17:23
 
Code:
date_default_timezone_set('Europe/Paris');
$time = strtotime('Tue, 31 Jul 2012 13:17:23 GMT');
echo date('Y-m-d', $time);
echo "\r\n\";
echo date('H:i:s', $time);

please note that GMT is not the same as BST. It is safest to rely on UTC for time stamps. then do the conversions to local time when you use the datum
 
cheers jpadie... i knew it were something simple like that!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top