I am generating time with a sql script

$query = "select current_timestamp as time";

When my system time is in 24 hrs format it returns a 24 hr format time. but when it is 12 hrs format it returns a 12 hr format time.

But I want my time to be in 24 hrs format.
Please any one have a technique that I can use to always generate time in 24 hrs format.
Or any convertion and detection script that would help me generate a 12 hr format and convert it to 24 hr format.

5 Years
Discussion Span
Last Post by diafol

The query should return it as 24 hours format (according to the manual). What do you do with the result of the query?

Edited by pritaeas


yeah it does returns 24 hr format when my system time is in 24 hrs format.

But if it is 12 hrs format I get a 12 hr format time.

It kind of confusing for me cos my app really needs time in 24hr format.


You can decide on the format - you shouldn't be a slave to your server / PC settings.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.