Re: time format

From: Martin Marques <martin(at)bugs(dot)unl(dot)edu(dot)ar>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: ivan <iv(at)psycho(dot)pl>, Kurt Roeckx <Q(at)ping(dot)be>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: time format
Date: 2004-01-05 03:50:02
Message-ID: 1073274602.3ff8deeaeeeb5@bugs.unl.edu.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Quoting Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> Martin Marques <martin(at)bugs(dot)unl(dot)edu(dot)ar> writes:
> > Look deeper into what Christopher said and use casting to get the right
> > output:
> > prueba=> select now()::timestamp(0);
>
> There's also "current_timestamp(0)", which is a more standards-compliant
> way of doing the same thing.

Didn´t know that existed. :-)

Anyway, my observation was not on the now() function, but at the casting. He
wants the output of th select over a timestamp field to come out without the
milliseconds, which is done with the casting.

Now, seeing your mail I realize that what he may want is this:

CREATE TABLE table_name (
.....
time_field timestamp(0)
);

Remember you will lose those milliseconds for ever with this table definition.

--
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués | mmarques(at)unl(dot)edu(dot)ar
Programador, Administrador, DBA | Centro de Telematica
Universidad Nacional
del Litoral
-----------------------------------------------------------------

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2004-01-05 05:45:43 Re: Is my MySQL Gaining ?
Previous Message A E 2004-01-05 03:26:23 Re: Anything akin to an Evaluate Statement in Postgresql?