Page 1 of 1

Conversion of JulianDate YYDDD to mm/dd/yy date format

Posted: Mon Aug 31, 2009 8:51 am
by vish08
In DB2, the julian date is 94167 defined as Decimal. I need to convert this into 06/16/94.
Tried DateFromJulianDay function but getting ***

Posted: Mon Aug 31, 2009 10:46 am
by chulett
That's not a Julian date but rather an Ordinal date, meaning the first two digits are the year and the next three are the day number for that year. From the manual:

"A Julian day specifies the date as the number of days from 4713 BCE January 1, 12:00 hours (noon) GMT"

In other words, just an integer. Sorry, not sure off the top of my head if there's a PX function to handle those kind of date fields or if you need to sub-string it and handle the pieces separately.

Re: Conversion of JulianDate YYDDD to mm/dd/yy date format

Posted: Mon Aug 31, 2009 9:22 pm
by mrajesh99
hi,
i think you can change it to date by using date_from_string function and specify the Date format as yyddd. you have to convert decimal to string first which can be achieved by using DecimalToString(CollName,"suppress_zero").

Re: Conversion of JulianDate YYDDD to mm/dd/yy date format

Posted: Mon Aug 31, 2009 9:25 pm
by mrajesh99
hi,
i think you can change it to date by using date_from_string function and specify the Date format as yyddd. you have to convert decimal to string first which can be achieved by using DecimalToString(CollName,"suppress_zero").

It Looks Similar to this

StringToDate(DecimalToString(Link_AU.AU_ID,"suppress_zero"),"%yy%ddd")

Posted: Mon Aug 31, 2009 11:19 pm
by harshada
hi,

Try using StringToDate(Trim(INP_DATE),"%yyyy%ddd")

~
Harshada..