Formats(String shortDateFormat, String mediumDateFormat, String longDateFormat, String shortTimeFormat, String mediumTimeFormat, String longTimeFormat, String integerFormat, String floatFormat, String percentageFormat, String currencyFormat, String[] monthNames, String[] monthAbbreviations, String[] weekdayNames, String[] weekdayAbbreviations, String[2] ampm)
amSource Codeshared String am
currencyFormatSource Codeshared String currencyFormat
floatFormatSource Codeshared String floatFormat
integerFormatSource Codeshared String integerFormat
longDateFormatSource Codeshared String longDateFormat
longTimeFormatSource Codeshared String longTimeFormat
mediumDateFormatSource Codeshared String mediumDateFormat
mediumTimeFormatSource Codeshared String mediumTimeFormat
monthAbbreviationsSource Codeshared String[] monthAbbreviations
monthNamesSource Codeshared String[] monthNames
percentageFormatSource Codeshared String percentageFormat
pmSource Codeshared String pm
shortDateFormatSource Codeshared String shortDateFormat
shortTimeFormatSource Codeshared String shortTimeFormat
weekdayAbbreviationsSource Codeshared String[] weekdayAbbreviations
weekdayNamesSource Codeshared String[] weekdayNames
Inherited Attributes
Attributes inherited from: Object
longFormatDateSource Codeshared String longFormatDate(ReadableDate date)
longFormatTimeSource Codeshared String longFormatTime(ReadableTime time, TimeZone timeZone)
mediumFormatDateSource Codeshared String mediumFormatDate(ReadableDate date)
mediumFormatTimeSource Codeshared String mediumFormatTime(ReadableTime time)
parseDateSource Codeshared Date? parseDate(String text, Order dateOrder = ..., Integer? twoDigitCutoffYear = ..., String separators = ...)

Given a string expected to represent a formatted date, comprising day, month, and year fields, the order of the fields in the formatted date, and a list of delimiting characters, return a Date, or null if the string cannot be interpreted as a date with the given field order and delimiters. If twoDigitCutoffYear is non-null, then formatted dates may be written with two-digit years.

For example

au.formats.parseDate("3 June 2010")

produces the date 2010-06-03, if au is the Locale for en-AU. And

us.formats.parseDate("01/02/03", monthDayYear)

produces the date 2003-01-02, if us is the Locale for en-US.

  • text

    The formatted date.

  • dateOrder = dayMonthYear

    The order of the fields of the fomatted date, usually dayMonthYear, yearMonthDay, or monthDayYear.

    • field order must include day

    • field order must include month

    • field order must include year

  • twoDigitCutoffYear = now().date().year-80

    The earliest year which can be written in two-digit form, or null if two-digit years should be interpreted literally. Defaults to 80 years before the current year.

  • separators = "/-., "

    The characters to recognize as field separators.

parseTimeSource Codeshared Time? parseTime(String text, String separators = ...)

Given a string expected to represent a formatted time, comprising an hour, followed by optional minute, second, and millisecond fields, followed by an optional AM or PM marker, and a list of delimiting characters, return a Time, or null if the string cannot be interpreted as a time with the given delimiters.

  • text

    The formatted time.

  • separators = ":. "

    The characters to recognize as field separators.

shortFormatDateSource Codeshared String shortFormatDate(ReadableDate date)
shortFormatTimeSource Codeshared String shortFormatTime(ReadableTime time)
Inherited Methods
Methods inherited from: Object