gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Default datetime precision


From: Jerzy Luszawski
Subject: Re: [Gnumed-devel] Default datetime precision
Date: Mon, 26 Aug 2013 17:41:50 +0200

> > >> At the creation of an encounter, it is sane that GNUmed offers by 
> > >> default, and saves, either
> > >> 
> > >>  now()
> > >> 
> > >> or maybe even better
> > >> 
> > >>  date_trunc('minute', now())
> > > 
> > > There is no choice in that. All date/time related fields in
> > > the database are declared "timestamp with time zone" thusly
> > > storing full precision down to the microsecond. If they
> > > weren't they COULD NOT store the time which is undesirable.
> > 
> > I would have thought that
> > 
> >     date_trunc('minute', now())
> > 
> > which is
> > 
> >     2013-08-25 08:35:00-08:00
> > 
> > and which contains full precision, down to zero seconds, qualifies as 
> > "timestamp with time zone".
> > 
> > It is merely that the seconds have been "zeroed out".
> 
> True enough, date_trunc() returns a timestamptz zeroed out.
> 
And, as days and months cannot be zero, it works like this (from PG
documentation):
SELECT date_trunc('year', TIMESTAMP '2001-02-16 20:38:40');
Result: 2001-01-01 00:00:00

This fits my idea of treating day 01 or month 01-01 as
"unknown" when time is 00:00:00.

-- 
Regards,
Jerzy Luszawski



reply via email to

[Prev in Thread] Current Thread [Next in Thread]