Re: Date Format Question - Mailing list pgsql-novice

From Frank Bax
Subject Re: Date Format Question
Date
Msg-id 5.2.1.1.0.20051205140503.03161630@pop6.sympatico.ca
Whole thread Raw
In response to Date Format Question  (Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>)
Responses Re: Date Format Question  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
At 01:33 PM 12/5/05, Ângelo Marcos Rigo wrote:
>I do receive a date from a text box with this format:
>dd/mm/yyyy
>
>And i am inserting into Postgresql Database usign
>(eg.):
>INSERT INTO Mycalendar (Date) VALUES
>(to_date('31/12/2005','mm/dd/yyyy')).
>
>But for the "day" values above 10 (wich have not a
>zero on his front) the month gets in the day place in
>the database so :
>31/12/2005 wich was suposed to be stored in this
>format 2005-31-12


That's weird, because on my system to_date('31/12/2005','mm/dd/yyyy')
produces 2007-07-14!  Perhaps you meant to_date('31/12/2005','dd/mm/yyyy')?


>Is being stored in this format : 2005-12-31


No it's not - that's just how you "see" it with a default select of date
column.


>How can i store the date in the right format:(2005-31-12) ?


You cannot - but to_char(date,'dd/mm/yyyy') might be what you are really
looking for.


pgsql-novice by date:

Previous
From: Ângelo Marcos Rigo
Date:
Subject: Date Format Question
Next
From: Tom Lane
Date:
Subject: Re: Date Format Question