Looking for the documentation on the newest versions of SIL Engine and the Simple Issue Language for Jira 8? Click here and leave these dusty old pages behind!
Availability
This routine is available starting with katl-commons 1.0.
Syntax
formatDate(date, format)
Description
Formats the given date into a date/time string accordingly to the given format expression.Parameters
Parameter name | Type | Required | Description |
---|---|---|---|
date | date | Yes | Specifies a Date or DateTime expression. |
format | string | Yes | Specifies a pattern expression representing the desired date format. |
Return type
string
The return value represents the formatted string representation for the given date.
Example
Example 1
string format = "yyyy.MM.dd G 'at' HH:mm:ss z"; print("Current time is " + formatDate(currentDate(), format));
Assuming that current date is 30.10.2011 and time 12:08, prints Today is 2011.10.30 AD at 12:08:00 PDT
Example 2
date varDateTime = "2011-08-17T18:30:55"; string format = "EEE, d MMM yyyy HH:mm:ss Z"; print("Formatted date is " + formatDate(varDateTime, format));
Print Formatted date is Wed, 17 Aug 2011 18:30:55 +0300
The date varDateTime in example 2 must follow the formats listed for date here
See also