Details
Description
The expression
new java.util.Date("6/22/96 12:15PM").toString()
throws an IllegalArgumentException. This is unfortunate.
If a space is added:
new java.util.Date("6/22/96 12:15 PM").toString()
the result is "Tue Jul 23 00:15:00 EDT 1996"
which has TWO mistakes in it: it has "Jul" instead of "Jun",
and it has advanced 12:15 PM to be 12:15 AM on the following day!
And if we try "AM":
new java.util.Date("6/22/96 12:15 AM").toString()
the result is "Mon Jul 22 12:15:00 EDT 1996"
which is also twelve hours later than it is supposed to be.
new java.util.Date("6/22/96 12:15PM").toString()
throws an IllegalArgumentException. This is unfortunate.
If a space is added:
new java.util.Date("6/22/96 12:15 PM").toString()
the result is "Tue Jul 23 00:15:00 EDT 1996"
which has TWO mistakes in it: it has "Jul" instead of "Jun",
and it has advanced 12:15 PM to be 12:15 AM on the following day!
And if we try "AM":
new java.util.Date("6/22/96 12:15 AM").toString()
the result is "Mon Jul 22 12:15:00 EDT 1996"
which is also twelve hours later than it is supposed to be.