Re: Time Conversion

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Time Conversion
Дата
Msg-id 5631.1111939563@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Time Conversion  ("Ryan Sommers" <ryans@gamersimpact.com>)
Список pgsql-novice
"Ryan Sommers" <ryans@gamersimpact.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

В списке pgsql-novice по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: I'd Like To See Permissions Granted
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: [pgsql-advocacy] Function which gives back the nearest neighbours