Date.from_nanos

Date.from_nanos

Date.from_nanos

Function

Creates a new Date object with a nanosecond Unix timestamp.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
nanosIntYesNoneNanosecond Unix timestamp.

Return value

TypeDescription
DateReturns a Date object corresponding to local time.

Code Example

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.