quickstopman Posted July 18, 2007 Share Posted July 18, 2007 i know this is probly something i should have learned along time ago but i have to idea on how to format the date so it doesn't look like 2007-07-16 19:45:30 and make it look like this July 16, 2007 7:45pm thanks in advance for the help Link to comment https://forums.phpfreaks.com/topic/60642-solved-how-to-format-the-time_stamp-date/ Share on other sites More sharing options...
Wildbug Posted July 18, 2007 Share Posted July 18, 2007 date('F j, Y g:ia',strtotime('2007-07-16 19:45:30')); Link to comment https://forums.phpfreaks.com/topic/60642-solved-how-to-format-the-time_stamp-date/#findComment-301694 Share on other sites More sharing options...
quickstopman Posted July 18, 2007 Author Share Posted July 18, 2007 how exactly would i implement it in the script? just put in on the top? or set it as some kind of variable Link to comment https://forums.phpfreaks.com/topic/60642-solved-how-to-format-the-time_stamp-date/#findComment-301700 Share on other sites More sharing options...
Daniel0 Posted July 18, 2007 Share Posted July 18, 2007 strtotime takes a formatted date and converts it to a UNIX timestamp. date takes a UNIX timestamp and formats it accordingly to the given format. See: http://php.net/strtotime and http://php.net/ Link to comment https://forums.phpfreaks.com/topic/60642-solved-how-to-format-the-time_stamp-date/#findComment-301704 Share on other sites More sharing options...
Wildbug Posted July 18, 2007 Share Posted July 18, 2007 Where are you getting your date from? <?php $mydate = '2007-07-16 19:45:30'; echo date('F j, Y g:ia',strtotime($mydate)); ?> (If you're drawing the dates from a database, you can also format them in the query using DATE_FORMAT(). Seems like I answered this issue at least thrice today.) Link to comment https://forums.phpfreaks.com/topic/60642-solved-how-to-format-the-time_stamp-date/#findComment-301706 Share on other sites More sharing options...
quickstopman Posted July 18, 2007 Author Share Posted July 18, 2007 i figured out how to get it too work Link to comment https://forums.phpfreaks.com/topic/60642-solved-how-to-format-the-time_stamp-date/#findComment-301721 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.