From: | Steve Crawford <scrawford(at)pinpointresearch(dot)com> |
---|---|
To: | "Gallamine" <iam(at)gallamine(dot)com>, <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: formatting current_timestamp |
Date: | 2002-12-13 20:18:46 |
Message-ID: | 20021213201847.2DB62103BD@polaris.pinpointresearch.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
From | Date | Subject | |
---|---|---|---|
Next Message | Gallamine | 2002-12-13 20:23:34 | recommended reading |
Previous Message | Josh Berkus | 2002-12-13 20:13:27 | Re: search and replace |