Julian calendar

Hi folks,

How to convert a date (julian format) into “MM/DD/AAAA” (gregorian format)?
Is there any built in service?


Take a look at pub.date:dateTimeFormat. You can specify a currentPattern and a newPattern. The docs for java.text.SimpleDateFormat will give you the format pattern you need for your julian date.

Hi Rob,

Thanks for you answer, but the things aren’t clear enough to me yet.
I’m reading a JDE database via JDBC (just reading, thats why I’m not using JDE Adapter) and JDE uses Julian format to store dates. I need to convert it into MM/dd/yyyy format, and if I understood your tip, the DDDDDD pattern should work. Is that correct?
When running dateTimeFormat with currentPattern = ‘DDDDDD’ and newPattern = ‘MM/dd/yyyy’ it returns me a value that doesn’t match the one I’m wating for. When using inString = ‘0’, the service returns me ‘12/32/1969’ as initial date.
Can you help me again, please?

[url=“JDK 19 Documentation - Home”]JDK 19 Documentation - Home has the list of allowable pattern letters and their meanings.

I’m not sure what “DDDDDD” will do as “DDD” is day in year.

[url=“http://www.myriadit.co.nz/jdedates.htm”]http://www.myriadit.co.nz/jdedates.htm[/url] has a good description of the format of JDE dates:

For those of you that don’t know the date format stored is as follows


C=Century, 0=19, 1=20, 2=21
YY=Last two digits of the year
DDD=day where 001=01 Jan, and 365=31 Dec or 30 Dec (leap year)

Unfortunately, the convention JDE apparently uses for indicating the century isn’t a standard convention and isn’t something supported by SimpleDateFormat.

You may be okay if you ignore the century indicator. Do a substring to get the last 5 chars from the string and then pass that substring to pub.date:dateTimeFormat with a current pattern of yyDDD. That should get you what you need.

If you can’t ignore the century indicator, then you’ll need to do a bit more work. Get a substring of the 1st char, placing it in var named centuryIndicator or something. Then branch on it to do this:

BRANCH on /centuryIndicator
…0 : MAP (set centuryStr to 19)
…1 : MAP (set centuryStr to 20)
…2 : MAP (set centuryStr to 21)

Then get the last 5 chars from the date string and append those to the centuryStr and pass the entire new string to dateTimeFormat with a pattern of yyyyDDD.


Gee … More than perfect.
Now it’s working fine
Many, many thanks, Rob.