THE PACKAGE JAVA.UTIL
java.util.Date
21.3
21.3.31
public static long parse(String s)
throws IllegalArgumentException
An attempt is made to interpret the string
s
as a representation of a date and time.
If the attempt is successful, the time indicated is returned represented as the dis
tance, measured in milliseconds, of that time from the epoch (00:00:00 GMT on
January 1, 1970). If the attempt fails, an
IllegalArgumentException
is thrown.
The string
s
is processed from left to right, looking for data of interest.
Any material in
s
that is within the ASCII parenthesis characters
(
and
)
is
ignored. Parentheses may be nested. Otherwise, the only characters permitted
within
s
are these ASCII characters:
abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789,+ :/
and whitespace characters ( 20.5.19).
A consecutive sequence of decimal digits is treated as a decimal number:
If a number is preceded by
+
or
and a year has already been recognized, then
the number is a time zone offset. If the number is less than 24, it is an offset
measured in hours. Otherwise, it is regarded as an offset in minutes, expressed
in 24 hour time format without punctuation. A preceding
+
means an east
ward offset and a preceding
means a westward offset. Time zone offsets are
always relative to UTC (Greenwich). Thus, for example,
5
occurring in the
string would mean five hours west of Greenwich and
+0430
would mean
four hours and thirty minutes east of Greenwich. It is permitted for the
string to specify
GMT
,
UT
, or
UTC
redundantly for example,
GMT 5
or
utc+0430
.
If a number is greater than 70, it is regarded as a year number. It must be fol
lowed by a space, comma, slash, or end of string. If it is greater than 1900,
then 1900 is subtracted from it.
If the number is followed by a colon, it is regarded as an hour, unless an hour
has already been recognized, in which case it is regarded as a minute.
If the number is followed by a slash, it is regarded as a month (it is decreased
by
1
to produce a number in the range
0
to
11
), unless a month has already
been recognized, in which case it is regarded as a day of the month.
If the number is followed by whitespace, a comma, a hyphen, or end of string,
then if an hour has been recognized but not a minute, it is regarded as a
minute; otherwise, if a minute has been recognized but not a second, it is
regarded as a second; otherwise, it is regarded as a day of the month.
631
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved