From: | Diego Gil <diego(at)adminsa(dot)com> |
---|---|
To: | Erik Jones <erik(at)myemma(dot)com> |
Cc: | Alban Hertroys <a(dot)hertroys(at)magproductions(dot)nl>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: datestyle question |
Date: | 2007-10-03 10:26:17 |
Message-ID: | 1191407177.3458.20.camel@roadwarrior.maipucinos.com.ar |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
El mié, 03-10-2007 a las 00:27 -0500, Erik Jones escribió:
> On Oct 2, 2007, at 8:56 PM, Diego Gil wrote:
>
> > El jue, 27-09-2007 a las 10:32 +0200, Alban Hertroys escribió:
> >> 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:
> >>
> > No, it realy means 20 Feb. My mistake !.
> >
> >
> >> insert into my_table (my_date_field)
> >> select to_date(my_date_text_field, 'DDMMYYYY') - interval '1 month'
> >> from my_temp_table;
> >>
> >> Regards,
> >
> > I finally ended coding a dirty C program to reverse the order of date
> > fields. Here is the code, in case anyone need it.
>
> I'm glad you got something working. However, out of morbid
> curiousity I have to ask: why did you use C for that when you could
> have done it with at most a three line script or even one line
> directly from the shell?
I am a lot more used to work with C (25+ years doing it). In fact, it is
easier to me writing it in C. That is all!. Could you post an
equivalente script, so I can try it and learn?.
"It is hard to teach new tricks to an old dog".
Regards,
Diego.
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2007-10-03 10:57:23 | Re: pg_cancel_backend() does not work with buzz queries |
Previous Message | Richard Huxton | 2007-10-03 10:18:32 | Re: pg_cancel_backend() does not work with buzz queries |