Re: date functions

From: Darren Ferguson <darren(at)crystalballinc(dot)com>
To: "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: date functions
Date: 2002-02-01 16:23:32
Message-ID: Pine.LNX.4.10.10202011121180.9106-100000@thread.crystalballinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

There is a Postgres function called to_char

Example:

SELECT a.tt_id,
to_char(a.date_time_submitted,CAST('mm/dd/yyyy' AS text)) AS
date_time_submitted
FROM table a
WHERE a.tt_id = id

RESULT: id | 12/31/2001

Look in the format of the function it is in the documentation. The
formatiing will show you other notations this is just one of them that
fitted on of your examples.

Darren Ferguson

On Fri, 1 Feb 2002, Johnson, Shaunn wrote:

> Howdy:
>
> Silly question. I want to display the date from
> my table in other formats. Is this possible?
>
> For example, I have this:
>
> [example]
>
> date
> ------------
> 2000-01-07
>
> [/example]
>
> And I want this:
>
> [example]
>
> date
> ------------
> 20000107
>
> [/example]
>
>
> And maybe this:
>
>
> [example]
>
> date
> ------------
> 01/07/2001
>
> [/example]
>
>
> Any suggestions? Thanks!
>
> -X
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message omid omoomi 2002-02-01 16:28:50 Re: date functions
Previous Message Jason Earl 2002-02-01 16:22:57 Re: date functions