Search Postgresql Archives

Re: datestyle question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



El mié, 26-09-2007 a las 17:22 -0500, Erik Jones escribió:
> On Sep 26, 2007, at 3:42 PM, 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.
> >
> > I tried and tried but I can't import those dates to postgresql.
> >
> > Any hint, other than editing file ?
> >
> > Regards,
> > Diego.
> 
> Check out the following link that explains how Postgres parses date  
> inputs: http://www.postgresql.org/docs/8.2/interactive/x71187.html,  
> particularly section 1.c
> 
> The simplest thing I can think of in your case would be to do a  
> little bit of text processing on that field before inserting it.  If  
> you simply insert dashes between the different fields so that you  
> have DD-MM-YYY then you can do
> 
> SET DateStyle TO 'DMY';
> 
> and then your copy should be ok.
> 
> Erik Jones
> 

Thanks Erik. I was trying to avoid this, mainly because I will have to
import several and different files. But having no other option, I will
start to refreshing my awk knowledge.

Regards,
Diego.




---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux