dwest Posted March 15, 2008 Share Posted March 15, 2008 Hi, I have a date and time supplied in this format: 2008-03-21 22:58:46 (the time is supplied as GMT) I want to display it in this format: March 21, 2008 at 3:58pm PDT (note Pacific Daylight Time) Any help would be greatly appreciated! Link to comment https://forums.phpfreaks.com/topic/96258-complicated-date-format-help-needed/ Share on other sites More sharing options...
l0ve2hat3 Posted March 15, 2008 Share Posted March 15, 2008 http://us2.php.net/date Link to comment https://forums.phpfreaks.com/topic/96258-complicated-date-format-help-needed/#findComment-492754 Share on other sites More sharing options...
dwest Posted March 15, 2008 Author Share Posted March 15, 2008 From what I can tell, and I'm no expert, date() formats a time taken from the server. I need to reformat a string that is in one date format to another. Thanks though Any other assistance would be appreciated. Link to comment https://forums.phpfreaks.com/topic/96258-complicated-date-format-help-needed/#findComment-492755 Share on other sites More sharing options...
dwest Posted March 15, 2008 Author Share Posted March 15, 2008 Disregard. Found this function: function reformat_date($date, $format){ // Function written by Marcus L. Griswold (vujsa) // Can be found at http://www.handyphp.com // Do not remove this header! $output = date($format, strtotime($date)); return $output; } And it works like a charm. Can be found here: http://www.handyphp.com/content/view/10/16/ Hope this helps someone Link to comment https://forums.phpfreaks.com/topic/96258-complicated-date-format-help-needed/#findComment-492756 Share on other sites More sharing options...
l0ve2hat3 Posted March 15, 2008 Share Posted March 15, 2008 $date = '2008-03-21 22:58:46'; echo $newdate = gmdate('F j, Y \a\t g:ia \P\S\T',strtotime('-8 hours'.$date)); Link to comment https://forums.phpfreaks.com/topic/96258-complicated-date-format-help-needed/#findComment-492760 Share on other sites More sharing options...
l0ve2hat3 Posted March 15, 2008 Share Posted March 15, 2008 Disregard. Found this function: function reformat_date($date, $format){ // Function written by Marcus L. Griswold (vujsa) // Can be found at http://www.handyphp.com // Do not remove this header! $output = date($format, strtotime($date)); return $output; } And it works like a charm. Can be found here: http://www.handyphp.com/content/view/10/16/ Hope this helps someone that wont work. use what i posted Link to comment https://forums.phpfreaks.com/topic/96258-complicated-date-format-help-needed/#findComment-492761 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.