pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
CURRENT_TIMSTAMP
3+ messages / 3 participants
[nested] [flat]

* CURRENT_TIMSTAMP
@ 2002-12-02 16:41 Raymond Chui <raymond.chui@noaa.gov>
  2002-12-02 18:38 ` Re: [SQL] CURRENT_TIMSTAMP Joel Burton <joel@joelburton.com>
  2002-12-02 21:27 ` Re: [SQL] CURRENT_TIMSTAMP Stephan Szabo <sszabo@megazone23.bigpanda.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Raymond Chui @ 2002-12-02 16:41 UTC (permalink / raw)
  To: pgsql-general@postgresql.org; pgsql-sql; pgsql-admin@postgresql.org

I created a column, dada type timstamp with time zone
and with default CURRENT_TIMSTAMP
it shows me the default is

default ('now'::text)::timstamp(6) with time zone

Then when I insert a row, the default timestamp value is

yyyy-mm-dd HH:MM:ss.mmmmm+00

where mmmmm is milliseconds.
How do I make default only yyyy-mm-dd HH:MM:ss+00 ?
Thank Q!

Attachments:

raymond.chui.vcf (text/x-vcard, 311B) download begin:vcard n:Chui;Raymond tel;work:301-713-0640 x168 x-mozilla-html:FALSE url:http://www.nws.noaa.gov/ org:NWS, NOAA;OHD13 version:2.1 email;internet:raymond.chui@noaa.gov title:CS adr;quoted-printable:;;1325 East-West Highway=0D=0ASSMC2, Room 8112;Silver Spring;MD;20910-3282;U.S.A. fn:Raymond Chui end:vcard
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: [SQL] CURRENT_TIMSTAMP
  2002-12-02 16:41 CURRENT_TIMSTAMP Raymond Chui <raymond.chui@noaa.gov>
@ 2002-12-02 18:38 ` Joel Burton <joel@joelburton.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Joel Burton @ 2002-12-02 18:38 UTC (permalink / raw)
  To: Raymond Chui <raymond.chui@noaa.gov>; +Cc: pgsql-general@postgresql.org; pgsql-sql; pgsql-admin@postgresql.org

On Mon, Dec 02, 2002 at 11:41:33AM -0500, Raymond Chui wrote:
> I created a column, dada type timstamp with time zone
> and with default CURRENT_TIMSTAMP
> it shows me the default is
> 
> default ('now'::text)::timstamp(6) with time zone
> 
> Then when I insert a row, the default timestamp value is
> 
> yyyy-mm-dd HH:MM:ss.mmmmm+00
> 
> where mmmmm is milliseconds.
> How do I make default only yyyy-mm-dd HH:MM:ss+00 ?
> Thank Q!

The problem isn't CURRENT_TIMESTAMP, it's your table definition.
If you create the field as timestamp(0) [in 7.3, that's timestamp(0)
with time zone, since the default has swung to no-TZ], it will keep
track of just HMS. Or put in other values for 0 for more granularity on
seconds.

Of course, you can always store the specific time and select it out
w/less resolution (using the time/date functions). In some cases, this
might be a better solution.

- J.

-- 

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] CURRENT_TIMSTAMP
  2002-12-02 16:41 CURRENT_TIMSTAMP Raymond Chui <raymond.chui@noaa.gov>
@ 2002-12-02 21:27 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Stephan Szabo @ 2002-12-02 21:27 UTC (permalink / raw)
  To: Raymond Chui <raymond.chui@noaa.gov>; +Cc: pgsql-general@postgresql.org; pgsql-sql; pgsql-admin@postgresql.org

On Mon, 2 Dec 2002, Raymond Chui wrote:

> I created a column, dada type timstamp with time zone
> and with default CURRENT_TIMSTAMP
> it shows me the default is
>
> default ('now'::text)::timstamp(6) with time zone
>
> Then when I insert a row, the default timestamp value is
>
> yyyy-mm-dd HH:MM:ss.mmmmm+00
>
> where mmmmm is milliseconds.
> How do I make default only yyyy-mm-dd HH:MM:ss+00 ?

As already suggested you probably want a timestamp with time zone(0)
column, but if you really want the ability to insert partial seconds but
the default to not have partial seconds, you can use
CURRENT_TIMESTAMP(0) I believe.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2002-12-02 21:27 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-12-02 16:41 CURRENT_TIMSTAMP Raymond Chui <raymond.chui@noaa.gov>
2002-12-02 18:38 ` Joel Burton <joel@joelburton.com>
2002-12-02 21:27 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox