Re: data storage for timestamp data type?

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Chirag Patel <chirag(at)chirag(dot)name>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: data storage for timestamp data type?
Date: 2007-08-14 19:56:06
Message-ID: 84A20856-3624-4ED1-9BCB-0FEA1801F904@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

[Please don't top post as it makes the discussion more difficult to
follow, and please reply to the list so that others may benefit from
and participate in the discussion.]

On Aug 14, 2007, at 14:38 , Chirag Patel wrote:

> Do you know how PostgreSQL stores the timestamp? The documentation
> indicates the following:
>
> "timestamp values are stored as seconds before or after
> midnight 2000-01-01"
>
> I understand that PostgreSQL accepts the timestamp in string format
> ('2003-07-29 13:19:30.5'). But how is it actually stored? For
> example, if I use timestamp(3), then is it total number of
> milliseconds since "midnight 2000-01-01"?

Again, it depends on whether or not the server was compiled with
enable-integer-datetimes. If so, it's stored as microseconds from
midnight 2000-01-01 (in an int8). If not, it's stored as seconds from
midnight 2000-01-01 (in a float8).

Michael Glaesemann
grzm seespotcode net

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Kevin McCarthy 2007-08-14 21:26:33 foreign key constraint to multiple tables
Previous Message Michael Glaesemann 2007-08-14 19:16:26 Re: data storage for timestamp data type?