Re: Time Conversion

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ryan Sommers" <ryans(at)gamersimpact(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Time Conversion
Date: 2005-03-27 16:06:03
Message-ID: 5631.1111939563@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"Ryan Sommers" <ryans(at)gamersimpact(dot)com> writes:
> How can I convert a VARCHAR(25) to a timestamp? Including a fraction of a
> second.

> The VARCHAR(25) column is in the form: YYYY-MM-DD HH:MI:SS.fffff
> where fffff is the fraction of a second.

> I could use to_timestamp but I can't find a conversion specifier for the
> fractional part.

Since that's a perfectly valid input format for timestamp, you could
just cast it.

regression=# select '2005-05-27 11:22:33.4567'::varchar::timestamp;
timestamp
--------------------------
2005-05-27 11:22:33.4567
(1 row)

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2005-03-27 16:32:12 Re: [NOVICE] [pgsql-advocacy] Function which gives back the nearest neighbours
Previous Message Bruno Wolff III 2005-03-27 15:54:31 Re: I'd Like To See Permissions Granted