Class jsworld.DateTimeFormatter
Class for localised formatting of dates and times.
See:
POSIX LC_TIME.
Defined in: <JsWorld.js>.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
jsworld.DateTimeFormatter(locale)
Creates a new date/time formatter for the specified locale.
|
| Method Attributes | Method Name and Description |
|---|---|
|
formatDate(date)
Formats a date according to the preset locale.
|
|
|
formatDateTime(date)
Formats a date/time value according to the preset
locale.
|
|
|
formatTime(date)
Formats a time according to the preset locale.
|
Class Detail
jsworld.DateTimeFormatter(locale)
Creates a new date/time formatter 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}
formatDate(date)
Formats a date according to the preset locale.
- Parameters:
- {Date|String} date
- A valid Date object instance or a string containing a valid ISO-8601 formatted date, e.g. "2010-31-03" or "2010-03-31 23:59:59".
- Throws:
- Error on invalid date argument
- Returns:
- {String} The formatted date
{String}
formatDateTime(date)
Formats a date/time value according to the preset
locale.
- Parameters:
- {Date|String} date
- A valid Date object instance or a string containing a valid ISO-8601 formatted date/time, e.g. "2010-03-31 23:59:59".
- Throws:
- Error on invalid argument.
- Returns:
- {String} The formatted time.
{String}
formatTime(date)
Formats a time according to the preset locale.
- Parameters:
- {Date|String} date
- A valid Date object instance or a string containing a valid ISO-8601 formatted time, e.g. "23:59:59" or "2010-03-31 23:59:59".
- Throws:
- Error on invalid date argument.
- Returns:
- {String} The formatted time.