The Date Class

The Date class provides methods for date formatting and parsing.

Methods

Class methods are static methods that do not require an object. The method name is prefixed by the class name.

Table 1. Class Methods (Static Member Methods)
Name Description
String  format(String format)
Formats a Date as a String according to a format specification.
Date fromIsoValue(String value)
Constructs a Date from the date value, which is expected in ISO date format ("YYYY-MM-DD").
Date fromString(String pattern, String value)
Creates a date variable by parsing value according to pattern.
Date parseString(String value, String format)
Constructs a Date from value. The parsing is based on the passed format pattern.
Date today()
Constructs a Date from the current date value. Returns a Date instance representing the current date.
String  toString(String pattern)
Creates a string by formatting the value of the date according to pattern.

Usage

With RTL classes, it is not possible to create and subclass objects. The new keyword is not supported.

These static methods do not require a Date object instance. When you invoke the method, it is prefixed with the Date class name and the '.'