pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joel Burton <joel@joelburton.com>
To: Raymond Chui <raymond.chui@noaa.gov>
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Cc: pgsql-admin@postgresql.org
Subject: Re: [SQL] CURRENT_TIMSTAMP
Date: Mon, 2 Dec 2002 13:38:27 -0500
Message-ID: <20021202183827.GB12953@temp.joelburton.com> (raw)
In-Reply-To: <3DEB8D3D.5353D375@noaa.gov>
References: <3DEB8D3D.5353D375@noaa.gov>

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



view thread (3+ messages)  latest in thread

Message-ID: <20021202183827.GB12953@temp.joelburton.com>
Permalink:  ../20021202183827.GB12953@temp.joelburton.com/
Also on:    postgresql.org/message-id/20021202183827.GB12953@temp.joelburton.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: joel@joelburton.com, raymond.chui@noaa.gov, pgsql-general@postgresql.org, pgsql-admin@postgresql.org
  Subject: Re: [SQL] CURRENT_TIMSTAMP
  In-Reply-To: <20021202183827.GB12953@temp.joelburton.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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