Re: Date Format Question

Поиск
Список
Период
Сортировка
От Frank Bax
Тема Re: Date Format Question
Дата
Msg-id 5.2.1.1.0.20051205140503.03161630@pop6.sympatico.ca
обсуждение исходный текст
Ответ на Date Format Question  (Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>)
Ответы Re: Date Format Question  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Ângelo Marcos Rigo
Дата:
Сообщение: Date Format Question
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Date Format Question