how to convert 5 digit julian date to calendar date ?

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
sumoka
Participant
Posts: 12
Joined: Thu Sep 13, 2007 9:21 pm

how to convert 5 digit julian date to calendar date ?

Post by sumoka »

Hi ,

if any body has a solution please help.

the desired format is YYYY-MM-DD

or any other format will do .
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

There is, unfortunately, no single definition or standard for "Julian Date". But DataStage has a function DateFromDaysSince() with which you can take the base date from your Julian and add the number of days to get a DATE value, which you can then format to your specifications. If your julian date happens to be the same as DataStages (which specifies "number of days from 4713 BCE January 1, 12:00 GMT") then you can use the builtin Julian date functions.
sumoka
Participant
Posts: 12
Joined: Thu Sep 13, 2007 9:21 pm

Post by sumoka »

The i/p is a decimal (5,0) 09134.

I tried teh following code :

DateFromJulianDay(AsInteger(Field(DecimalToString(<ColumnName>,"fix_zero") ,".",1) ))

it gives teh o/p in '*' i.e. junk :-)
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Of course that will give incorrect output. In order to do ANY date work, DataStage (and you) need to know what actual date is represented by "09134" -> is it Febrary 13th, 1242 or December 1st, 2005 or some other date? Once you know that date, then you can use the DateFromDaysSince function.
karrisuresh
Participant
Posts: 57
Joined: Sat Jun 09, 2007 1:14 am
Location: chicago

Re: how to convert 5 digit julian date to calendar date ?

Post by karrisuresh »

Hi Can you tell what is ur input and what is the out put u want
if possible quote an example
Hi I have experience in parallel extender datastage I am ready to give/take help from other
hope we all help each other hand in hand
sumoka
Participant
Posts: 12
Joined: Thu Sep 13, 2007 9:21 pm

Post by sumoka »

Hi ,

The i/p is a decimal (5,0) 09134.

and I don't know the standard date representation.

I understand my limitations here .. if anybody can give a solid hint.. which after a little working on can yield a result it wil be great.
sumoka
Participant
Posts: 12
Joined: Thu Sep 13, 2007 9:21 pm

Post by sumoka »

Hi ,

The i/p is a decimal (5,0) 09134.

and I don't know the standard date representation.

I understand my limitations here .. if anybody can give a solid hint.. which after a little working on can yield a result it wil be great.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Go back to your source, where the data comes from. Ask them what date that value represents. There's no way for us to know.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Could 09134 represent the 134th day of 2009? That format is also sometimes referred to as "Julian". And is easily converted.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sumoka
Participant
Posts: 12
Joined: Thu Sep 13, 2007 9:21 pm

Post by sumoka »

Thanks Ray ,

will assume the representation mentioned by you and work on it.

will share the solution once I get it.

Thanks again.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If this is true you can use StringToDate() with an appropriate date format mask string.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dganeshm
Premium Member
Premium Member
Posts: 91
Joined: Tue Aug 11, 2009 3:26 pm

Post by dganeshm »

ray.wurlod wrote:If this is true you can use StringToDate() with an appropriate date format mask string. ...
Hi Ray,

I tried using the following format :

StringToDate(DSLink2.flm[12,5],"%yy%(ddd,v)")

but am getting the warning :

Transformer_9,0: Conversion error calling conversion routine date_from_ustring data may have been lost

Regards
Regards,
Ganesh
dganeshm
Premium Member
Premium Member
Posts: 91
Joined: Tue Aug 11, 2009 3:26 pm

Post by dganeshm »

ray.wurlod wrote:If this is true you can use StringToDate() with an appropriate date format mask string. ...
Hi Ray,

I tried using the following format :

StringToDate(DSLink2.flm[12,5],"%yy%(ddd,v)")

but am getting the warning :

Transformer_9,0: Conversion error calling conversion routine date_from_ustring data may have been lost

Regards
Regards,
Ganesh
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

And that only took you three months?!! Amazing! What else have you tried?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dganeshm
Premium Member
Premium Member
Posts: 91
Joined: Tue Aug 11, 2009 3:26 pm

Post by dganeshm »

ray.wurlod wrote:And that only took you three months?!! Amazing! What else have you tried? ...
I actually started following this topic today.. trying to figure out what the exact date should look like from the source..
Regards,
Ganesh
Post Reply