Skip site navigation (1) Skip section navigation (2)

Re: datestyle question

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Diego Gil" <diego(at)adminsa(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: datestyle question
Date: 2007-09-26 22:24:02
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
On 9/26/07, Diego Gil <diego(at)adminsa(dot)com> 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.
> I tried and tried but I can't import those dates to postgresql.
> Any hint, other than editing file ?

There are two approaches.  One is to use something like sed or awk or
perl or php to read the file and rearrange those bits to a format that
makes sense to pgsql, or you can import that field into a text field,
and use something like substring() in postgresql to update a new field
that holds dates with the right numbers.

In response to


pgsql-general by date

Next:From: TUC SolutionsDate: 2007-09-26 22:27:12
Subject: Arabic Language
Previous:From: Erik JonesDate: 2007-09-26 22:22:40
Subject: Re: datestyle question

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group