Support for large dates - say 5874897-12-31

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
manish1005
Participant
Posts: 39
Joined: Thu Nov 23, 2006 11:23 pm

Support for large dates - say 5874897-12-31

Post by manish1005 »

Hi,

I wish to insert records with large dates as in 5874897-12-31. The field can contain smaller dates as well say 101-12-31. The function date_from_string in datastage requires exact date format %yyyy-%%mm-%dd, but my data can vary from %yyy-%mm-%dd to %yyyyyyy-%mm-%dd.

Is there any way to convert such strings to date format? and also is there any upper limit on that? My database supports dates till year 5874897.


Another question is, is there any way to load dates with BC & AD values in them like - 4713-01-01 BC. My database supports it but I could not figure out how to make DataStage understand that this is a valid date. If I map varchar to date type I have to convert it manually using some function, date_from_string also does not seems to understand dates with BC, AD.

Please suggest.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Support for large dates - say 5874897-12-31

Post by chulett »

Ok, let me be the first to ask - what database supports 'large dates' like that and why in the world would you want to use them? :?
manish1005 wrote:date_from_string also does not seems to understand dates with BC, AD.

Please suggest.
Suggest you leave that bit off.
-craig

"You can never have too many knives" -- Logan Nine Fingers
manish1005
Participant
Posts: 39
Joined: Thu Nov 23, 2006 11:23 pm

Post by manish1005 »

>what database supports 'large dates' like that.
Well postgres database supports that, and i guess other datases would also support atleast dates with 5 digit years %yyyyy-%mm-%dd

>why in the world would you want to use them
why not, say I have a database of objects related to archeology(or may be even astronomy) which gives me dates from carbon dating of dinosaur bones. (instead of writing years, I wish to store it in date format with month/date as 01-01 and of course in BC era).

Moreover, instead of questioning *why* I have to provide a solution for *how* part :(
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Just curiousity on my part is all.

No clue on the how. If no-one else pops in here having done that before, why not open a case with your official Support provider? Go back to the source and ask them if they can support dates of that nature.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You might have trouble with variable-length date formatting in PX. How about keeping your date in a numeric (i.e. Julian) form and then using your database SQL to perform the to_date() conversion?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Standard ISO8601 only defines dates to 9999-12-31.

DataStage conforms to that standard, as do most (though clearly not all) commercial databases.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
manish1005
Participant
Posts: 39
Joined: Thu Nov 23, 2006 11:23 pm

Post by manish1005 »

Regarding ISO8601 standard, it allows negative dates for BCE. But when I tried to supply negative dates ( -1001-11-11) it gave error for the negative sign.


Julian format can be a workaround, but how do I convert dates in my source flat files to julian format?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

This might be an argument for a BASIC transform stage and the ICONV()/OCONV() functions.
Post Reply