While on an 11g BPEL implementation, I had a fairly simple request to convert a date format from Julian to calendar. I shrugged off the request as simple, and thought it shouldn't take more than a few minutes. I was entertained by the fact that you can convert a date to Julian, but nothing was provided, unless I missed it, to convert a date from Julian!
Not that Julian is used very often, but when it is, most of the time it needs to be converted to calendar date for better recognition.
I did a search and found some complex solutions. Some of the solutions involved functions and java code and some didn't even warrant an entire read through. In either case, I just needed something quick and dirty, not necessarily to be re-used in multiple places.
Here is what I came up with!
A quick breakdown of my thought process:
1. Use the year portion of the Julian date to create a date object as January 1st.
2. Pull out the days portion of the Julian date, (subtract 1 - the date is already on the 1st) and create a duration string (ie. 'P125D')
3. Add the duration to the January 1st date created.
4. Format as necessary
The final product:
<xsl:value-of select='xp20:format-dateTime(xp20:add-dayTimeDuration-to-dateTime(concat(substring(/julianDt,0.0,5.0),"-01-01"), concat("P",(number(substring(/julianDt,5.0))-1),"D")), "[Y0001]-[M01]-[D01]")'/>
Hope this saves someone the time that it took me to finally figure it out!