Re: Datetime - Mailing list pgsql-sql

From Tom Lane
Subject Re: Datetime
Date
Msg-id 23178.1091546009@sss.pgh.pa.us
Whole thread Raw
In response to Re: Datetime  (Michael Glaesemann <grzm@myrealbox.com>)
Responses Re: Datetime
List pgsql-sql
Michael Glaesemann <grzm@myrealbox.com> writes:
> No. I'm just saying that PostgreSQL does not represent or store 
> timestamps as epoch timestamps internally.

You're wrong.

It's not exactly Unix-like because we use a different epoch date
(2000-1-1 not 1970-1-1) but the concept is just the same: what's
stored is the number of seconds before or after the epoch.  The
default is to store this as a double precision number (hence supporting
fractional seconds, with a machine-dependent amount of precision)
but you can compile the server to use 64-bit integers instead.  In that
case the integer value actually represents microseconds before or after
the epoch, and so the precision is fixed at microseconds.

What you see when you display the value is an external textual
representation, not the internal form.  This is generally true for
all Postgres datatypes except text/varchar/char ...
        regards, tom lane


pgsql-sql by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Datetime
Next
From: Michael Glaesemann
Date:
Subject: Re: Datetime