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 Quote Link to comment 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')); Quote Link to comment 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 Quote Link to comment 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/ Quote Link to comment 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.) Quote Link to comment 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 Quote Link to comment 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.