Date.from_string
Date.from_string
Function
Parses a date string and creates a new Date object.
Syntax
date_value.from_string(text)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| text | String | Yes | None | A date string or second-level Unix timestamp string. |
Return value
| Type | Description |
|---|---|
| Date | Returns the parsed Date object. |
Code Example
result = date().from_string('2026-06-09').format('%Y-%m-%d %H:%M:%S') // Output: 2026-06-09 00:00:00
Notes
- Supports
YYYY-MM-DD HH:mm:ss,YYYY/MM/DD HH:mm:ss,YYYY-MM-DDTHH:mm:ss,YYYY/MM/DDTHH:mm:ss, minute precision and plain date formats. - The pure date will be padded to the current day according to the local time zone
00:00:00. - Empty strings or unrecognized date strings will result in an error.