wellscam Posted June 25, 2008 Share Posted June 25, 2008 Hi! I am retreiving information from an Access database using PHP, and having a problem displaying the time. Here is my Query and the line that returns the time: $sql0 = "SELECT * FROM AllInfo WHERE Extension = '$ex' AND Date=#$id#"; echo '<td><center>'.$row['Time'].'</center></td>'; And this is what it returns: 1899-12-30 06:31:00 I can't figure out how to make the time (1899-12-30 06:31:00) show up with just the time (06:31). I have read the overview in the code repository, but it just deals with MySql timestamps and this is from an Access Database. Everything I try just breaks my page. Help!! ??? Quote Link to comment https://forums.phpfreaks.com/topic/111898-time-format-from-ms-accessphp-query/ Share on other sites More sharing options...
ober Posted June 25, 2008 Share Posted June 25, 2008 try: echo '<td><center>'.date("h:i", strtotime($row['Time'])).'</center></td>'; Quote Link to comment https://forums.phpfreaks.com/topic/111898-time-format-from-ms-accessphp-query/#findComment-574366 Share on other sites More sharing options...
wellscam Posted June 25, 2008 Author Share Posted June 25, 2008 That didn't work for my Time date, but I had another column called DateTime that it worked perfectly for...thank you so much!! Quote Link to comment https://forums.phpfreaks.com/topic/111898-time-format-from-ms-accessphp-query/#findComment-574375 Share on other sites More sharing options...
ober Posted June 25, 2008 Share Posted June 25, 2008 What is the data format on the field in the database? Quote Link to comment https://forums.phpfreaks.com/topic/111898-time-format-from-ms-accessphp-query/#findComment-574397 Share on other sites More sharing options...
wellscam Posted June 25, 2008 Author Share Posted June 25, 2008 I'm not sure, but that's okay, I can just change my query to use the data from the field that it does work on and get the results I need. Quote Link to comment https://forums.phpfreaks.com/topic/111898-time-format-from-ms-accessphp-query/#findComment-574409 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.