newphpcoder Posted October 24, 2011 Share Posted October 24, 2011 Good Day!I had problem in displaying datetime using select statement.I have TimeIn and TimeOut with datatype DateTimeI want to display it (dd-mm-yyyy) and the hours is 12 hours with AM and PM.now it display:TimeIn: 2011-10-24 05:35:00TimeOut: 2011-10-24 13:35:00this is my code: $sql = "SELECT EMP_NO, TimeIn, TimeOut FROM attendance WHERE Date BETWEEN '$DATE1' AND '$DATE2'"; I want to display the dataTimeIn: 24-10-2011 05:35 AMTimeOut: 24-10-2011 014:35 PMI tried to find syntax for that but it did not match on what format i want.Thank youThank you Link to comment Share on other sites More sharing options...
Synook Posted October 24, 2011 Share Posted October 24, 2011 Use strtotime() and date() in PHP. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 24, 2011 Share Posted October 24, 2011 You can also have MySQL format the date: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.