formatDate
formatDate returns a string representation of a date-time for a specified time zone, formatted as yyyy-MM-dd.
Syntax
formatDate(instant, timeZone)
formatDate(dateTime)
Parameters
| Parameter | Type | Description |
|---|---|---|
| instant | Instant | The Instant to format as a string. |
| timeZone | ZoneId | The time zone used when formatting the string. |
| dateTime | ZonedDateTime | The time to format as a string. |
Returns
The time, formatted as a yyyy-MM-dd string.
Examples
datetime = parseInstant("2022-01-01T00:00:00 ET")
formatted_date = formatDate(datetime, timeZone("ET"))
println formatted_date