Re: date - Mailing list pgsql-sql

From Ken Hill
Subject Re: date
Date
Msg-id 1139588221.29808.7.camel@localhost.localdomain
Whole thread Raw
In response to Re: date  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Responses Re: date
List pgsql-sql
On Fri, 2006-02-10 at 07:38 +0100, A. Kretschmer wrote: <blockquote type="CITE"><pre>
<font color="#000000">am  09.02.2006, um 22:18:09 -0800 mailte superboy143 (sent by Nabble.com) folgendes:</font>
<font color="#000000">> </font>
<font color="#000000">> Hello,</font>
<font color="#000000">> </font>
<font color="#000000">> How can I write an sql query in postgresql so that I can insert a date into</font>
<font color="#000000">> a table in the format DD-MM-YYYY, and when I select the date from the table</font>
<font color="#000000">> I should get the date in the same format.</font>

<font color="#000000">You can't define the format in the db, but you can define the</font>
<font color="#000000">output-format with to_char(date, 'DD-MM-YYYY');</font>


<font color="#000000">HTH, Andreas</font>
</pre></blockquote> You could also try using the data_part() function:<br /><br />
date_part('month',date)||-||date_part('day',date)||-||date_part('year',date)<br/><br /> But I think Andreas' suggestion
isa bit more elegant.<br /><br /> 

pgsql-sql by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: date
Next
From: Ken Hill
Date:
Subject: Re: query