DarkMantis Posted January 19, 2012 Share Posted January 19, 2012 Hi Guys, I have got a date string which looks like the following: Thu Feb 09 2012 07:25:00 GMT 0000 (GMT Standard Time) I need to convert it to d-m-Y H:i format. Any ideas on how to do this? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/255367-formatting-a-php-date-from-string/ Share on other sites More sharing options...
grissom Posted January 19, 2012 Share Posted January 19, 2012 This function might help http://www.php.net/manual/en/datetime.createfromformat.php Quote Link to comment https://forums.phpfreaks.com/topic/255367-formatting-a-php-date-from-string/#findComment-1309285 Share on other sites More sharing options...
RussellReal Posted January 19, 2012 Share Posted January 19, 2012 strtotime and date however, Grissom, might have the best alternative, should strtotime fail to be what you need, since you can explicitly set how the function should handle that date.. thumbs up to grissom Quote Link to comment https://forums.phpfreaks.com/topic/255367-formatting-a-php-date-from-string/#findComment-1309288 Share on other sites More sharing options...
DarkMantis Posted January 19, 2012 Author Share Posted January 19, 2012 Thanks guys, Im using the DateTime::createFromFormat method. Thanks to the both of you though! Quote Link to comment https://forums.phpfreaks.com/topic/255367-formatting-a-php-date-from-string/#findComment-1309296 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.