Time
zune.time
A library to interact with date and time.
Functions
timestamp
Returns the current unix timestamp in seconds.
timestamp(): numbertimestampMillis
Returns the current unix timestamp in milliseconds.
timestampMillis(): numberNamespaces
date
FUNCTIONS
now
date.now(): DateTimeThrows
- DateTime Error
- Memory Error
fromIsoDate
Parse a string in ISO8601 format, YYYY-MM-DDTHH:MM:SSZ.
date.fromIsoDate(date: string): DateTimeParameters
date: string- The date string to parse.
Throws
- DateTime Error
- Memory Error
fromUnixTimestamp
date.fromUnixTimestamp(timestamp: number): DateTimeParameters
timestamp: number- The unix timestamp in seconds.
Throws
- DateTime Error
- Memory Error
fromUnixTimestampMillis
date.fromUnixTimestampMillis(timestamp: number): DateTimeParameters
timestamp: number- The unix timestamp in milliseconds.
Throws
- DateTime Error
- Memory Error
fromLocalTime
date.fromLocalTime(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number): DateTimeParameters
year: numbermonth: numberday: numberhour: numberminute: numbersecond: numbermillisecond: number
Throws
- DateTime Error
- Memory Error
fromUniversalTime
date.fromUniversalTime(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number): DateTimeParameters
year: numbermonth: numberday: numberhour: numberminute: numbersecond: numbermillisecond: number
Throws
- DateTime Error
- Memory Error
parse
Parse a date string.
- Supports ISO8601 format,
YYYY-MM-DDTHH:MM:SSZ. - Supports RFC3339 format,
YYYY-MM-DDTHH:MM:SS+00:00. - Supports RFC2822 format,
Day, DD Mon YYYY HH:MM:SS GMT.
date.parse(date: string): DateTimeParameters
date: string- The date string to parse.
Throws
- DateTime Error
- Memory Error
instant
FUNCTIONS
now
Returns a timespec in a buffer form, first 8 bytes are seconds, next 4 bytes are nanoseconds. buffer should always be 12 bytes long.
instant.now(): bufferThrows
- Time Error
- Memory Error
Last updated on