Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: [GENERAL] datestyle question

From: Alban Hertroys <a.hertroys(at)magproductions.nl>
Date: Thu Sep 27 2007 - 04:32:53 EDT


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 //

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
Received on Thu Sep 27 04:36:26 2007

This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 11:55:16 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library