Date.format
Date.format
Function
Output date and time in chrono/strftime style format string.
Syntax
date_value.format(pattern)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| pattern | String | No | %Y-%m-%d %H:%M:%S | Format string. |
Return value
| Type | Description |
|---|---|
| String | Returns the formatted date string. |
Code Example
d = date('2026-06-09 10:11:12') result = d.format('%Y-%m-%d') // Output: 2026-06-09
Notes
- Format characters use chrono/strftime style, such as
%Y-%m-%d %H:%M:%S,%F %T. - When pattern is not passed,
%Y-%m-%d %H:%M:%Sformat is returned.