Re: Datetime

From: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: Michael Glaesemann <grzm(at)myrealbox(dot)com>
Cc: "Pedro B(dot)" <pedro(dot)borracha(at)netcabo(dot)pt>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Datetime
Date: 2004-08-03 11:50:43
Message-ID: Pine.LNX.4.44.0408031449340.7249-100000@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

O kyrios Michael Glaesemann egrapse stis Aug 3, 2004 :

>
> On Aug 3, 2004, at 7:23 PM, Achilleus Mantzios wrote:
>
> > now() returns the current UNIX (your running UNIX right?) timestamp
> > which
> > in turn is
> > measured in seconds,miliseconds since the epoch.
> > i.e. 1970-01-01 00:00:00
>
> I believe this is incorrect. I believe PostgreSQL uses its own

Do you suggest postgresql has any other means of getting
time except the time(2) syscall??

> timestamp datatype internally (which is, indeed, not as text in an
> easy-to-read form). On my machine (running cvs-head),
>
> test=# select now();
> now
> -------------------------------
> 2004-08-03 20:27:18.822646+09
> (1 row)
>
> which is definitely not seconds.milliseconds since epoch. You can use
> extract to get seconds.milliseconds from epoch, but I don't think this
> is how it's stored internally.
>
> test=# select extract(epoch from now());
> date_part
> -----------------
> 1091532506.3222
> (1 row)
>
> Just some additional trivia, current_timestamp is an SQL-spec compliant
> alias for now(), and might be a better choice if one is concerned with
> compatibility.
>
> Michael Glaesemann
> grzm myrealbox com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>

--
-Achilleus

In response to

  • Re: Datetime at 2004-08-03 11:31:11 from Michael Glaesemann

Responses

  • Re: Datetime at 2004-08-03 13:26:14 from Michael Glaesemann

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2004-08-03 13:26:14 Re: Datetime
Previous Message Michael Glaesemann 2004-08-03 11:31:11 Re: Datetime