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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Koukoulis <pkoukoulis(at)gmail(dot)com>
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 20:35:24
Message-ID: 24929.1503866124@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Koukoulis 2017-08-27 21:03:07 Re: hrs, mins and seconds do not appear with to_char
Previous Message Dmitry Igrishin 2017-08-27 20:32:59 Re: Using the dollar sign as a prefix for named parameter of prepared statement.