From: Ken Hill <ken@scottshill.com>
To: A. Kretschmer <andreas.kretschmer@schollglas.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: date
Date: Fri, 10 Feb 2006 08:17:00 -0800
Message-ID: <1139588221.29808.7.camel@localhost.localdomain> (raw)
In-Reply-To: <20060210063823.GC29845@webserv.wug-glas.de>
References: <2865031.post@talk.nabble.com>
<20060210063823.GC29845@webserv.wug-glas.de>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: ken@scottshill.com, andreas.kretschmer@schollglas.com
Subject: Re: date
In-Reply-To: <1139588221.29808.7.camel@localhost.localdomain>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox