Jul 31, 2012 #1 pushyr Programmer Joined Jul 2, 2007 Messages 159 Location 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
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
Jul 31, 2012 1 #2 jpadie Technical User Joined Nov 24, 2003 Messages 10,094 Location FR 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 Upvote 0 Downvote
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
Aug 1, 2012 Thread starter #3 pushyr Programmer Joined Jul 2, 2007 Messages 159 Location GB cheers jpadie... i knew it were something simple like that! Upvote 0 Downvote