Re: now() vs 'epoch'::timestamp

From: James Cloos <cloos(at)jhcloos(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: now() vs 'epoch'::timestamp
Date: 2015-04-01 20:43:07
Message-ID: m3d23nfulg.fsf@carbon.jhcloos.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>>> "SF" == Stephen Frost <sfrost(at)snowman(dot)net> writes:

>> (now()::timestamp without time zone - 'epoch'::timestamp without time zone)::reltime::integer
>> (Incidently, is there a better way in 9.4?)

SF> Uh, select extract('epoch' from now()); ?

Thanks. Back when I first needed it (years ago), that long line was the
only recomendation I could find.

SF> The only thing I'd say about this is that you *really* want to use
SF> timestamptz in PG for storing timestamps.

I normally do, but this table hasn't changed in years. Maybe 7.4 or so
was current when it started.

Thanks!

-JimC
--
James Cloos <cloos(at)jhcloos(dot)com> OpenPGP: 0x997A9F17ED7DAEA6

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2015-04-01 21:16:18 Re: now() vs 'epoch'::timestamp
Previous Message TonyS 2015-04-01 19:51:06 Re: Would like to know how analyze works technically