Re: date

From: Ken Hill <ken(at)scottshill(dot)com>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: date
Date: 2006-02-10 16:17:00
Message-ID: 1139588221.29808.7.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 2006-02-10 at 07:38 +0100, A. Kretschmer wrote:

> am 09.02.2006, um 22:18:09 -0800 mailte superboy143 (sent by Nabble.com) folgendes:
> >
> > Hello,
> >
> > How can I write an sql query in postgresql so that I can insert a date into
> > a table in the format DD-MM-YYYY, and when I select the date from the table
> > I should get the date in the same format.
>
> You can't define the format in the db, but you can define the
> output-format with to_char(date, 'DD-MM-YYYY');
>
>
> HTH, Andreas

You could also try using the data_part() function:

date_part('month',date)||-||date_part('day',date)||-||
date_part('year',date)

But I think Andreas' suggestion is a bit more elegant.

In response to

  • Re: date at 2006-02-10 06:38:23 from A. Kretschmer

Responses

  • Re: date at 2006-02-10 16:59:48 from Tom Lane

Browse pgsql-sql by date

  From Date Subject
Next Message Ken Hill 2006-02-10 16:22:03 Re: query
Previous Message Osvaldo Rosário Kussama 2006-02-10 16:07:52 Re: date