Date.from_timestamp
Date.from_timestamp
Function
Creates a new Date object with a Unix timestamp in seconds.
Syntax
date_value.from_timestamp(timestamp)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| timestamp | Int | Yes | None | Second-level Unix timestamp. |
Return value
| Type | Description |
|---|---|
| Date | Returns a Date object corresponding to local time. |
Code Example
result = date().from_timestamp(1).timestamp() // Output: 1
Notes
- The original Date object will not be modified, this method returns a new Date object.
- An error will be reported when the timestamp cannot be converted to local time.