Re: formatting current_timestamp

Поиск
Список
Период
Сортировка
От Steve Crawford
Тема Re: formatting current_timestamp
Дата
Msg-id 20021213201847.2DB62103BD@polaris.pinpointresearch.com
обсуждение исходный текст
Ответ на formatting current_timestamp  ("Gallamine" <iam@gallamine.com>)
Ответы Re: formatting current_timestamp  (David C.Oshel <dcoshel@inav.net>)
Список pgsql-novice
Try to_char:

 select to_char(CURRENT_TIMESTAMP, 'As text: FMDay FMMonth FMDD\n"A date:"
YYYY-MM-DD\nA time: HH:MM:SS');
                             to_char
-----------------------------------------------------------------
 As text: Friday December 13
A date: 2002-12-13
A time: 12:12:05
(1 row)

Of course, pick from the many formatting options that suit your need (Note:
preceeding an option with 'FM' trims of excess spaces and you may have to
quote things that could be incorrectly interpreted as formatting (the 'd' in
"A date" for example would be replaced with the day of week if not quoted).

Cheers,
Steve

On Friday 13 December 2002 12:03 pm, Gallamine wrote:
> Is there anyway that I can format CURRENT_TIMESTAMP so all it gives me is
> the data and not the long hours;minutes;seconds part? I like to use it to
> give a time to things put in the DB but the string is a little long for my
> likeing.
> -William
>
>
> [ GoRobotics.net | RobotGeeks.com | RobotDirectory.org ]
> Amateur robotics for the masses. Enter the world of robotics
> ------------------------------------------------------------
> "...God maintains a delicate balance between keeping his
> existence sufficiently evident so people will know He's there
> and yet hiding his presence enough so that people who
> want to choose to ignore him can do it "
>  - J.P. Moreland PH.D.
> ----------------------------------------------------------------
> Carpe Aeternum - Seize Eternity
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly

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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: search and replace
Следующее
От: "Gallamine"
Дата:
Сообщение: recommended reading