Re: hrs, mins and seconds do not appear with to_char

From: Peter Koukoulis <pkoukoulis(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: hrs, mins and seconds do not appear with to_char
Date: 2017-08-27 21:03:07
Message-ID: CABpxA9jDza5nJBK6tNCmmSbvi4nJmvNOawKZXYYKZtTdOX=NUQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

thanks. didn't realise they were different. I discovered the difference
when using a MD5 comparison between the 2 databases in a C++ utility.
All values were matching apart from dates.

Cheers
P

On Sun, 27 Aug 2017 at 21:35 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Peter Koukoulis <pkoukoulis(at)gmail(dot)com> writes:
> > I am unsure as to why the hrs, mins and seconds do not appear for a date
> > column.
>
> Uh, because it's a date.
>
> > When performing the exact same queries in Oracle, I get the full date
> > formatted to "yyyymmddhh24miss", but cannot get the same for PostgreSQL,
> > for example:
>
> Oracle has a nonstandard notion of what "date" means, I believe. You
> probably want to use type "timestamp", and the to_timestamp() function,
> in PG if you want behavior similar to what Oracle is doing.
>
> https://www.postgresql.org/docs/current/static/datatype-datetime.html
>
> regards, tom lane
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2017-08-28 00:44:19 Logging the fact that a log was shipped
Previous Message Tom Lane 2017-08-27 20:35:24 Re: hrs, mins and seconds do not appear with to_char