Class jsworld.DateTimeParser
Class for parsing localised date and time strings.
Defined in: <JsWorld.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
jsworld.DateTimeParser(locale)
Creates a new date/time parser for the specified locale.
|
Method Attributes | Method Name and Description |
---|---|
parseDate(formattedDate)
Parses a date string formatted according to the
POSIX LC_TIME d_fmt property of the preset locale.
|
|
parseDateTime(formattedDateTime)
Parses a date/time string formatted according to the
POSIX LC_TIME d_t_fmt property of the preset locale.
|
|
parseTime(formattedTime)
Parses a time string formatted according to the
POSIX LC_TIME t_fmt property of the preset locale.
|
Class Detail
jsworld.DateTimeParser(locale)
Creates a new date/time parser for the specified locale.
- Parameters:
- {jsworld.Locale} locale
- A locale object specifying the required POSIX LC_TIME formatting properties.
- Throws:
- Error on constructor failure.
Method Detail
{String}
parseDate(formattedDate)
Parses a date string formatted according to the
POSIX LC_TIME d_fmt property of the preset locale.
- Parameters:
- {String} formattedDate
- The formatted date, must be valid.
- Throws:
- Error on a parse exception.
- Returns:
- {String} The parsed date in ISO-8601 format (YYYY-MM-DD), e.g. "2010-03-31".
{String}
parseDateTime(formattedDateTime)
Parses a date/time string formatted according to the
POSIX LC_TIME d_t_fmt property of the preset locale.
- Parameters:
- {String} formattedDateTime
- The formatted date/time, must be valid.
- Throws:
- Error on a parse exception.
- Returns:
- {String} The parsed date/time in ISO-8601 format (YYYY-MM-DD HH:MM:SS), e.g. "2010-03-31 23:59:59".
{String}
parseTime(formattedTime)
Parses a time string formatted according to the
POSIX LC_TIME t_fmt property of the preset locale.
- Parameters:
- {String} formattedTime
- The formatted time.
- Throws:
- Error on a parse exception.
- Returns:
- {String} The parsed time in ISO-8601 format (HH:MM:SS), e.g. "23:59:59".