Exception questions

A

Arne Vajhøj

It's entirely relevant because the ISO 8601 version, the one that does
have a year 0, is the version implemented by java.util.Calendar.

?

java.util.Calendar.getInstance return a java.util.GregorianCalendar.

The Java Docs for java.util.GregorianCalendar explicit state:

<quote>
Value of the ERA field indicating the period before the common era
(before Christ), also known as BCE. The sequence of years at the
transition from BC to AD is ..., 2 BC, 1 BC, 1 AD, 2 AD,...
</quote>

Where did you see that it should have a year zero ?
I notice on the one hand you argue for projecting the system back to
prior to its invention, when you argue in favor of a year "one", but for
not projecting the system back when it justifies having a year "zero".
That is inconsistent.

It depends on which version of the Gregorian calendar you use. Since
this is a Java discussion, I'm using the one that Java uses.

Me to !

Arne
 
A

Arne Vajhøj

?

java.util.Calendar.getInstance return a java.util.GregorianCalendar.

The Java Docs for java.util.GregorianCalendar explicit state:

<quote>
Value of the ERA field indicating the period before the common era
(before Christ), also known as BCE. The sequence of years at the
transition from BC to AD is ..., 2 BC, 1 BC, 1 AD, 2 AD,...
</quote>

Where did you see that it should have a year zero ?


Me to !

And a standard SUN Java 1.6 seems to follow docs:

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class TestCalendar {
private static DateFormat df = new SimpleDateFormat("MMMM d y G");
public static void main(String[] args) {
Calendar cal = Calendar.getInstance();
System.out.println(cal.getClass().getName());
cal.set(Calendar.YEAR, 1);
System.out.println(df.format(cal.getTime()));
System.out.println(cal.get(Calendar.YEAR));
cal.add(Calendar.YEAR, -1);
System.out.println(df.format(cal.getTime()));
System.out.println(cal.get(Calendar.YEAR));
}
}

java.util.GregorianCalendar
marts 26 01 AD
1
marts 26 01 BC
1

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top