amit.dalmia
amit.dalmia

Reputation: 86

How do we extract the hour value in 24 hours format from a DateTime value with time stored as 12 hours format with AM and PM?

I have a column with where dateTime stamp is present. Want to extract the value of the hour in 24 hours format while the time value stored in the field is in 12 Hours format, in AM and PM.

Upvotes: 1

Views: 2839

Answers (1)

Rafal Mazgaj
Rafal Mazgaj

Reputation: 64

Maybe, You use the function to_char and set the parameter yyyy-mm-dd hh24:mi:ss.

Check this query:

SELECT TO_CHAR(column_name, 'yyyy-mm-dd hh24:mi:ss') FROM table_name;

Upvotes: 2

Related Questions