Hi everyone,
I need to convert a julian date with formate yyyyddd to regular date formate, for example,
if the input is 2005001, then the output is 01/01/2005. Does datastage have a built-in function to do that, otherwise I have to write my own logic, which is very complicated, because I have to consider leap years.
Your suggestions will be appreciated.
thanks.
julian date conversion
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If you can be certain that your source data are correct you can write a simple expression, maybe encapsulating it for re-use in a Transform.
(assuming you want month-day-year order. Adjust the second argument of Oconv for other formats.
If you are not certain that your source data are correct Julian dates then you would be better of with a routine that can check.
Code: Select all
Oconv(Iconv(JulianDate, "DYJ"), "D/MDY[2,2,4]")
If you are not certain that your source data are correct Julian dates then you would be better of with a routine that can check.
Code: Select all
FUNCTION JulianToMDY(JulianDate)
intDate = Iconv(JulianDate, "DYJ")
If Status() = 0
Then
Ans = Oconv(intDate, "D/MDY[2,2,4]")
End
Else
Ans = @NULL
Call DSTransformError("Invalid Julian date (" : JulianDate : ")", "JulianToMDY")
End
RETURN(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.