Date.from_nanos
Date.from_nanos
Function
Creates a new Date object with a nanosecond Unix timestamp.
Syntax
date_value.from_nanos(nanos)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| nanos | Int | Yes | None | Nanosecond Unix timestamp. |
Return value
| Type | Description |
|---|---|
| Date | Returns a Date object corresponding to local time. |
Code Example
result = date().from_nanos(1000000000).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 nanosecond timestamp cannot be converted to local time.