Page 1 of 1

how to convert 5 digit julian date to calendar date ?

Posted: Thu Nov 11, 2010 7:01 am
by sumoka
Hi ,

if any body has a solution please help.

the desired format is YYYY-MM-DD

or any other format will do .

Posted: Thu Nov 11, 2010 8:16 am
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.

Posted: Thu Nov 11, 2010 8:28 am
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 :-)

Posted: Thu Nov 11, 2010 8:51 am
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.

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

Posted: Thu Nov 11, 2010 9:00 am
by karrisuresh
Hi Can you tell what is ur input and what is the out put u want
if possible quote an example

Posted: Thu Nov 11, 2010 9:11 am
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.

Posted: Thu Nov 11, 2010 9:13 am
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.

Posted: Thu Nov 11, 2010 9:54 am
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.

Posted: Thu Nov 11, 2010 3:17 pm
by ray.wurlod
Could 09134 represent the 134th day of 2009? That format is also sometimes referred to as "Julian". And is easily converted.

Posted: Fri Nov 12, 2010 1:00 am
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.

Posted: Fri Nov 12, 2010 1:50 am
by ray.wurlod
If this is true you can use StringToDate() with an appropriate date format mask string.

Posted: Mon Feb 14, 2011 2:09 pm
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

Posted: Mon Feb 14, 2011 2:11 pm
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

Posted: Mon Feb 14, 2011 3:44 pm
by ray.wurlod
And that only took you three months?!! Amazing! What else have you tried?

Posted: Mon Feb 14, 2011 4:02 pm
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..