Re: datestyle question

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: datestyle question
Дата
Msg-id 46FB6AB5.60904@magproductions.nl
обсуждение исходный текст
Ответ на datestyle question  (Diego Gil <diego@adminsa.com>)
Ответы Re: datestyle question  (Diego Gil <diego@adminsa.com>)
Список pgsql-general
Diego Gil wrote:
> Hi,
>
> I have a file to import to postgresql that have an unusual date format.
> For example, Jan 20 2007 is 20022007, in DDMMYYYY format, without any
> separator. I know that a 20072002 (YYYYMMDD) is ok, but I don't know how
> to handle the DDMMYYYY dates.

You could try importing those fields in a text field in a temporary
table and then convert them from there into your final tables using the
to_date() function.

If 20022007 really means 20 Jan instead of 20 Feb, try something like:

insert into my_table (my_date_field)
select to_date(my_date_text_field, 'DDMMYYYY') - interval '1 month'
  from my_temp_table;

Regards,
--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: PQntuples return type
Следующее
От: "Peter Childs"
Дата:
Сообщение: Re: Performance Issues