Home Postgres SQL Date conversion
Reply: 1

Postgres SQL Date conversion

TAR Published in 2018-01-12 15:44:02Z

I have a field stored as timestamp without time zone which looks like this 2017-12-26 06:56:54.958. When I convert it like this:

to_char(date_field, 'DD/MM/YYYY hh24:mm:ss')

I end up with 26/12/2017 06:12:54. Does anybody know why? And if so, is there a way around this. As you can see, 44 minutes are removed from the date giving a time of 06:12 rather than 06:56.

I have tried to convert to UTC and GMT but I have had no luck. Any help would be greatly appreciated.

clemens Reply to 2018-01-12 15:46:13Z


to_char(date_field, 'DD/MM/YYYY HH24:MI:SS')

MI is the pattern for minutes. MM is for months, and the case is irrelevant.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.33313 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO