|
From: Nathan G. <nat...@ma...> - 2003-12-02 03:35:02
|
Thank you much. Wasn't aware that one of the formatting parameters existed for the era.
I thought that it would/should report BC numbers as negative without [the need for] formatting.
Anyhow, thanks again.
-nat
-----Original Message-----
From: Steven R. Loomis [mailto:sr...@jt...]
Sent: Monday, December 01, 2003 7:22 PM
To: Nathan Gross
Cc: icu...@ww...
Subject: Re: HebrewCalendar's getTime() does not report BCE dates as such.
On 01-Diċ-2003, at 3:56 PM, Nathan Gross wrote:
> Thanks for the help. Following is a simple example.
OK. The issue is that the format you used doesn't show the era.
Consider:
public static void main(String[] args) {
SimpleDateFormat df = new SimpleDateFormat("", Locale.US);
df.applyPattern("d MMMM, yyyy G");
HebrewCalendar hc1 = new HebrewCalendar(3800,10,10);
HebrewCalendar hc2 = new HebrewCalendar(3721,10,10);
System.out.println("This is correct since its AD: "+
hc1.getTime());
System.out.println("However, with a full format: " +
df.format(hc1.getTime()));
System.out.println("This is *wrong* since its BC: "+
hc2.getTime());
System.out.println("However, with a full format: " +
df.format(hc2.getTime()));
}
This is correct since its AD: Sat Jul 09 00:00:00 PST 0040 However, with a full format: 9 July, 0040 AD This is *wrong* since its BC: Sat Jun 12 00:00:00 PST 0040 However, with a full format: 12 June, 0040 BC <-- (US locale)
Again, the milliseconds of the Date is correct, it was just that the
formatter did not output the era.
Hope this helps,
Regards,
Steven
|