>>I was trying to initialise java.util.Date from substrings which I'd miscalculated. Quite
happily accepted a month of 0 (it adjusted the year to suit).<<

As strange as it may seem the Docs for the
java.util.Date package states( take particular notice of the statement about the month
values)

From Java Docs for java.util.Date:
"In all methods of class Date that accept or return year, month, date, hours, minutes, and seconds values, the following representations are used:

· A year y is represented by the integer y - 1900.
· A month is represented by an integer form 0 to 11; 0 is January, 1 is February, and so forth; thus 11 is December.
· A date (day of month) is represented by an integer from 1 to 31 in the usual manner.
· An hour is represented by an integer from 0 to 23. Thus, the hour from midnight to 1 a.m. is hour 0, and the hour from noon to 1 p.m. is hour 12.
· A minute is represented by an integer from 0 to 59 in the usual manner.

· A second is represented by an integer from 0 to 60; the value 60 occurs only for leap seconds and even then only in Java implementations that actually track leap seconds correctly. "

And I aggree with you that Calendar, GregorianCalender and Date are indeed  spastic
and confusing.

Cheers
Chris
 

John Summerfield wrote:

On Mon, 25 Jan 1999, Ryan Sutter wrote:

> This method allows incorrect dates like 13/9/98 without complaining.  My
Looks good here.

<whinge>
The classes java.util.GregorianCalendar java.util.Date java.util.Calendar
java.sql.Date are spastic. Most of the methods in java.util.Date ar
deprecated. Between them, these classes do all kinds of esoteric things
hardly anyone wants to do and completely omit something basic such as
returning the day of the week. Sure they take invlaid dates: I was trying
to initialise java.util.Date from substrings which I'd miscalculated. Quite
happily accepted a month of 0 (it adjusted the year to suit).

I'd like to be able to find the day of the week (no market prices today?
It's Sunday? That's okay then!), the difference between two dates (how old
will Mum be on Jan 1 2001?), to store and manipulate dates in and before
the last century.
</whinge>

--
Cheers
John Summerfield
http://os2.ami.com.au/os2/ for OS/2 support.
Configuration, networking, combined IBM ftpsites index.

Reply via email to