formatting current_timestamp
formatting current_timestamp
От:
"Gallamine" <iam@gallamine.com>
Дата:
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
Re: formatting current_timestamp
От:
Steve Crawford <scrawford@pinpointresearch.com>
Дата:
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
Re: formatting current_timestamp
От:
David C.Oshel <dcoshel@inav.net>
Дата:
This resource is invaluable, but I wish I could print off the 500 or so
all-time best q&a's and read at leisure.
Is there a downloadable archive or "YANK" compendium for pgsql-novice?
YANK, of course, means "Ynfrequently Asked Non-trivial Kwestions",
similar to RTFDSOMO ("read the $50 summary of menu options" ;-).
--
David C. Oshel mailto:dcoshel@inav.net
Cedar Rapids, Iowa http://soli.inav.net/~dcoshel
``I think most pleasantly in metaphors, and smoking brings metaphors to
mind." - Augustus Srb, in Alexei Panshin's _Star Well_