sql - How to get now() time with AM/PM in Postgresql -
for illustration when execute next query
select now()::time
the result
"10:48:28.421"
so how time am/pm ?? (ex. 10:48:28 am)
note : computer's location set english(united states)
, postgresql locale that
try this
select to_char(now()::time, 'hh12:mi:ss am')
live demo
output:
to_char 05:00:12
refer formatting functions
sql postgresql datetime
No comments:
Post a Comment