File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Problem with Gregorian Calendar BC Date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with Gregorian Calendar BC Date" Watch "Problem with Gregorian Calendar BC Date" New topic
Author

Problem with Gregorian Calendar BC Date

prakash Venkatesan
Greenhorn

Joined: Mar 11, 2004
Posts: 2
For a BC Date in Gregorian Calendar,if the year is leap year
i am not able to store the date 29 for month of February,
if i am trying to store '29-2-2004' for BC date it is conveting
in to '1-3-2004', this is not the problem for AD dates,for AD dates it is
working fine,the problem is only with BC Dates,can anyone clear this for me
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Since this doesn't have anything to do with Swing/JFC/AWT GUI stuff, I'm moving this post to the Java In General - Intermediate forum.

Also, the reason for this is probably due to the fact that to calculate a leap year in the present, future, or recent past all you need is the formula that a leap year is a year divisable by 4, but not 100, unless it is also divisible by 400. However, if you go far into the past, you also have to apply historical knowledge that doesn't follow a formula. Prior to October 15, 1582 dates you get from the GregorianCalendar class will actually use the Julian calendar instead. The Julian calendar also has leap years, and they are (were?) calculated similarly to the Gregorian calendar. However, the concept of the leap year was only introduced in 46 BC, and there's a gap between 9 BC and 8 AD due to making up for miscalculations early on. (Most of this information was gleaned from this page.)

So, 2004 BC would not be a leap year because leap years did not exist at that point. (err.. well... at least as a concept.)


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with Gregorian Calendar BC Date