mercredi 8 février 2017

Unable to get TIME_FORMAT to show 24-hour time

Vote count: 0

Using mySQL 5.6.

I am storing time in my database like this:

15:00:00

(So that's 3:00 pm.)

When I want to select data based on time, I do something like this:

SELECT * FROM mytable
WHERE TIME_FORMAT('03:00 pm', '%H:%i:%s');

But this returns 03:00:00, so no match.

I have tried all of the following:

SELECT TIME_FORMAT('03:00 pm', '%H:%i:%s')
SELECT TIME_FORMAT('03:00 pm', '%h:%i:%s')
SELECT TIME_FORMAT('03:00 pm', '%T')

And NONE of them give me the 15:00:00 that I need.

What am I not getting here?

asked just now

Let's block ads! (Why?)



Unable to get TIME_FORMAT to show 24-hour time

Aucun commentaire:

Enregistrer un commentaire