When I run a query to display a datetime in MySQL, the time displayed is sometimes 0:00:00, even though when I query for the hour, minute, or second, I get the values I would expect.
As you can see, the stored time is 9:24:23, but the displayed time is 0:00:00.
The column datetime has a data type datetime. Is there a way to get my queries to display the correct time without doing a terrible concat(hour,minute,second) workaround?
EDIT: Sometimes, I get the datetime as expected, and I don't see any difference between the times that display and those that don't.
Here's the table setup:
This would appear to be a problem in user interface. One solution is to format the value as a string:
select date_format(datetime, '%Y-%m-%d %H:%i:%s')
This should print correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With