formatdate(format, time) formats time using the given format string. time must be an RFC 3339 timestamp string.
Signature
Format tokens
| Token | Description | Example |
|---|---|---|
YYYY | Four-digit year | 2024 |
YY | Two-digit year | 24 |
MM | Two-digit month | 01-12 |
MMM | Three-letter month abbreviation | Jan |
MMMM | Full month name | January |
DD | Two-digit day | 01-31 |
D | Day without leading zero | 1-31 |
hh | Two-digit hour (24-hour) | 00-23 |
mm | Two-digit minute | 00-59 |
ss | Two-digit second | 00-59 |
ZZZ | Timezone abbreviation | UTC |
Z | Timezone offset | +00:00 |
Example
Stamp a release artifact with a timestamp passed in from the environment or CI system:app-1.4.2-2024-03-15.tar.gz.
Notes
timemust be a valid RFC 3339 string (e.g.2024-03-15T10:30:00Z). An invalid format produces an error at evaluation time.formatdatedoes not perform timezone conversion. The output timezone depends on the input timestamp.