Create a report design document / RTL Class Reference |
The Date class provides methods for date formatting and parsing.
Date
Class methods are static methods that do not require an object. The method name is prefixed by the class name.
Name | Description |
---|---|
fromIsoValue(String value) |
Constructs a Date from the date value; returns a Date instance
representing the value. The value is expected in iso format ("YYYY-MM-DD"). Using the function guarantees that the Date value is constructed correctly without the danger of runtime parse errors due to changing 4GL date formatting or locale settings. |
parseString(String value, String format) |
Constructs a Date from value. The parsing is based on the passed format pattern. See Formatting Symbols for Dates. |
format(java.lang.String.format) |
Formats a Date as a String according to a format specification. The format specification is 4GL-compatible. Returns a string representation of the date. See Formatting Symbols for Dates. |
today() |
Constructs a Date from the current date value. Returns a Date instance representing the current date. |
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 '.' For example, this expression uses the isoValue of the variable orderline.orders.orderdate to create a valid date for this value in the specified format: Date.fromIsoValue(orderline.orders.orderdate.isoValue).format("DDD DD MMM YYYY")
The formatting symbol can use either uppercase or lowercase letters.
Character | Description |
---|---|
dd | Day of the month as a two-digit integer. |
ddd | Three-letter English-language abbreviation of the day of the week, for example, Mon, Tue. |
mm | Month as a two-digit integer. |
mmm | Three-letter English-language abbreviation of the month, for example, Jan, Feb. |
yy |
Year, as a two-digit integer representing the two trailing digits. |
yyyy | Year as a four-digit number. |