DateFormat.parse

DateFormat.parse

Class Overview | Class Members | This Package | All Packages

Syntax 1
public Date parse( String text ) throws ParseException
Description
Parse a date/time string.

Exceptions
ParseException If the given string cannot be parsed as a date.
See Also
parse



Syntax 2
public abstract Date parse( String text, ParsePosition pos )
Parameters
text
The date/time string to be parsed
pos
On input, the position at which to start parsing; on output, the position at which parsing terminated, or the start position if the parse failed.
Returns
A Date, or null if the input could not be parsed
Description
Parse a date/time string according to the given parse position. For example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date that is equivalent to Date(837039928046).

By default, parsing is lenient: If the input is not in the form used by this object's format method but can still be parsed as a date, then the parse succeeds. Clients may insist on strict adherence to the format by calling setLenient(false).

See Also
setLenient