One of my favourite programming inconveniences and frequent source of bugs is shared by Java and Perl, so it is probably inherited from C and cannot be changed in order not to break old and fearsome legacy code.
Java
public final void set(int year, int month, int date)
- Sets the values for the fields year, month, and date.
Previous values of other fields are retained. If this is not desired,
call
clearfirst. - Parameters:
year- the value used to set the YEAR time field.month- the value used to set the MONTH time field. Month value is 0-based. e.g., 0 for January.date- the value used to set the DATE time field.
Perl
Perl, in fact, is even worse in that it bases its month at 0 and its years at 1900.Converts a time as returned by the time function to a 9-element list with the time analyzed for the local time zone. Typically used as follows:
|
All list elements are numeric, and come straight out of the C `struct
tm'. $sec, $min, and $hour are the seconds, minutes, and hours of the
specified time. $mday is the day of the month, and $mon is the month
itself, in the range 0..11 with 0 indicating January and 11
indicating December. $year is the number of years since 1900. That
is, $year is 123 in year 2023. $wday is the day of the week, with
0 indicating Sunday and 3 indicating Wednesday. $yday is the day of
the year, in the range 0..364 (or 0..365 in leap years.) $isdst
is true if the specified time occurs during daylight savings time,
false otherwise.



