I need to convert ordinal dates like 2011001 (Jan 1, 2011) to MM/dd/yyyy format (01/01/2011). XSLT 2.0 is OK.
I may not have asked this correctly; I’m not sure what additional information one would need to help solve this issue. Let me know and I will provide any needed info. Any solutions or pointers appreciated.
This will work in XSLT 2.0:
The secret is to use the ordinal as an offset from Jan 1 of the supplied year. Then, format-date can output the date in any format you want.
You could it using substring() instead of xsl:analyze-string but this way lets you ensure you only try to convert dates in the proper format.