I same to remember reading that GregorianCalendar handles Julian dates before the switch over?
Also its worth noting that not all countries changed to the gregorian claendar at the same time, I beleive (god this is dredge my uni memory) that Great Britain was rather late in changing over compared to teh rest of Europe.
Joined: Aug 16, 2007
Originally posted by Gavin Tranter: I same to remember reading that GregorianCalendar handles Julian dates before the switch over?
Couldn't catch your words? Did you mean Gregorian Calender itself manages Julian dates also?
Originally posted by Gavin Tranter: Also its worth noting that not all countries changed to the gregorian claendar at the same time, I beleive (god this is dredge my uni memory) that Great Britain was rather late in changing over compared to teh rest of Europe.
[Vishal]: Did you mean Gregorian Calender itself manages Julian dates also?
Yes. This is described in the GregorianCalendar API. If you want to create a calendar which is always Julian, callsetGregorianChange() and set it to some date in the far future. Or if you want to create a calendar that is always Gregorian, set the change date to something in the distant past.
Problem: I am working on a multi-tiered system that has components that run on different operating systems. I need a julian timestamp in java that will matchup with the julian timestamp on the Tandem (HP) os. If it were HPUX, that would be great, but it's not.
The beginning of the epoch for Tandem/HP is 12/31/74
The beginning of the epoch for Java is 1/1/70
Right now, the timestamps we're generating are being interpreted as dates in the far future. It's all wrong.
On the PCs and Unix machines, we're fine. On the Tandem, we're in "tomorrowland"...
Any ideas on how I can set the calendar object to have a different "epoch" start date and get a julian timestamp?
Why do you call that "Julian"? There are three kinds of "Julian" dating that I know of:
1. The system used by astronomers to standardly number their days. Its origin is around 3000 BCE (can't remember exactly).
2. The predecessor to the Gregorian calendar which we all use today, which is now only used to find out when religious holidays take place in Eastern European countries.
3. The term "Julian day" to refer to the number of the day in the year, between 1 and 366.
Your Tandem dating doesn't have anything to do with any of those. Hopefully Tandem doesn't use the term "Julian" in their documentation...
Anyway, when you get the number of milliseconds since the Tandem epoch, just add the number of milliseconds between the Java epoch and the Tandem epoch and you'll have the number of milliseconds since the Java epoch. You can calculate that offset in advance.
Mary Ann Finnerty
Joined: Feb 23, 2004
Good timing. What I did was get a calendar object for today, and a calendar object initialized to the tandem epoch start date.
I forced the time values in the tandem calendar to 0 (otherwise it was getting the current hr/min/sec/milli) and used the getTimeInMillis() method for each calendar and did:
today in millis - tandem today in millis / 10 (for centiseconds, since tandem timestamps use centiseconds)
I have a telnet to the tandem where I'm getting the timestamp via command line and a java utility that I just wrote to spit out the timestamps generated here, and they finally match.