>> So howcum Calendar and DateFormat are so unfriendly to each other?
> How?
How not?
import java.text.*;
import java.util.*;
public final class DateStuff {
private static final DateFormat df =
new SimpleDateFormat("EEEE, MMMM dd, yyyy");
public static void main(String[] args) {
final Calendar c =
new GregorianCalendar(2000, Calendar.JANUARY, 1);
c.add(Calendar.DATE, -9999);
final Date d = new Date(c.get(Calendar.YEAR),
c.get(Calendar.MONTH),
c.get(Calendar.DATE));
System.out.println(df.format(d));
}
}
Not only clunky, but it produces a warning (deprecation) message.

Signature
John W. Kennedy
"Sweet, was Christ crucified to create this chat?"
-- Charles Williams. "Judgement at Chelmsford"
* TagZilla 0.066 * http://tagzilla.mozdev.org
Arne Vajhøj - 13 Mar 2007 02:00 GMT
> import java.text.*;
> import java.util.*;
[quoted text clipped - 17 lines]
>
> Not only clunky, but it produces a warning (deprecation) message.
Yes.
It is deprecated to use the Date constructor with arguments.
import java.text.*;
import java.util.*;
public final class DateStuff {
private static final DateFormat df = new SimpleDateFormat("EEEE,
MMMM dd, yyyy");
public static void main(String[] args) {
Calendar c = new GregorianCalendar(2000, Calendar.JANUARY, 1);
c.add(Calendar.DATE, -9999);
System.out.println(df.format(c.getTime()));
}
}
is both simpler and not deprecated.
Arne
John W. Kennedy - 13 Mar 2007 03:58 GMT
>> import java.text.*;
>> import java.util.*;
[quoted text clipped - 36 lines]
>
> is both simpler and not deprecated.
Ah! In order to get a Date from a Calendar, I use "getTime".
Right.
Razzafrazzin' germbelstwithin' flollilocks!
Heigh-ho!
Many thanks....

Signature
John W. Kennedy
"The grand art mastered the thudding hammer of Thor
And the heart of our lord Taliessin determined the war."
-- Charles Williams. "Mount Badon"
* TagZilla 0.066 * http://tagzilla.mozdev.org
Roedy Green - 13 Mar 2007 19:37 GMT
On Mon, 12 Mar 2007 20:54:55 -0400, "John W. Kennedy"
<jwkenne@attglobal.net> wrote, quoted or indirectly quoted someone who
said :
>new Date(c.get(Calendar.YEAR),
> c.get(Calendar.MONTH),
> c.get(Calendar.DATE));
Date is the lemon of Java. The only way to fix the problem was to
deprecate most of Date. It has only a tiny few legit uses left.
see http://mindprod.com/jgloss/gotchas.html#DATE

Signature
Canadian Mind Products, Roedy Green, http://mindprod.com
Priorities: Prevent global climate destabilisation. End both wars. Prepare for oil shortages.