webguync Posted May 21, 2010 Share Posted May 21, 2010 Hi, I have a timestamp in MySQL pulling the data out like so... echo "<td>{$row["submit_timestamp"]}</td></tr>"; understand I can use strtotime to get a more readable date and time. Currently looks like 2010-05-17 11:32:45 would rather it say, May 17, 2010 11:32:45am and if it is pm be 9:30:45pm in that format. thanks in advance for any assistance. Link to comment https://forums.phpfreaks.com/topic/202543-help-incorporating-strtotime-to-get-timedate/ Share on other sites More sharing options...
kenrbnsn Posted May 21, 2010 Share Posted May 21, 2010 Use a combination of the strtotime and date functions. Ken Link to comment https://forums.phpfreaks.com/topic/202543-help-incorporating-strtotime-to-get-timedate/#findComment-1061796 Share on other sites More sharing options...
webguync Posted May 21, 2010 Author Share Posted May 21, 2010 thanks. Where would the date() and strtotime() functions need to go in the code I provided? Need a little help with the syntax. Link to comment https://forums.phpfreaks.com/topic/202543-help-incorporating-strtotime-to-get-timedate/#findComment-1061826 Share on other sites More sharing options...
kenrbnsn Posted May 22, 2010 Share Posted May 22, 2010 <?php echo "<td>" . date('F j, Y g:i:sa', strtotime($row["submit_timestamp"])) . "</td></tr>"; ?> Ken Link to comment https://forums.phpfreaks.com/topic/202543-help-incorporating-strtotime-to-get-timedate/#findComment-1061872 Share on other sites More sharing options...
webguync Posted May 23, 2010 Author Share Posted May 23, 2010 great thanks! Link to comment https://forums.phpfreaks.com/topic/202543-help-incorporating-strtotime-to-get-timedate/#findComment-1062096 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.