Class: LocalTime

types~LocalTime(totalNanoseconds)

A time without a time-zone in the ISO-8601 calendar system, such as 10:30:05. LocalTime is an immutable date-time object that represents a time, often viewed as hour-minute-second. Time is represented to nanosecond precision. For example, the value "13:45.30.123456789" can be stored in a LocalTime.

Constructor

new LocalTime(totalNanoseconds)

Creates a new instance of LocalTime.

Parameters:
Name Type Description
totalNanoseconds Long

Total nanoseconds since midnight.

Source:

Members

(readonly) hour :Number

Gets the hours, a number from 0 to 24.

Type:
  • Number
Source:

(readonly) minute :Number

Gets the minutes, a number from 0 to 59.

Type:
  • Number
Source:

(readonly) nanosecond :Number

Gets the nanoseconds, a number from 0 to 999 999 999.

Type:
  • Number
Source:

(readonly) second :Number

Gets the seconds, a number from 0 to 59.

Type:
  • Number
Source:

Methods

compare(other) → {number}

Compares this LocalTime with the given one.

Parameters:
Name Type Description
other LocalTime

time to compare against.

Source:
Returns:

0 if they are the same, 1 if this object is larger, -1 if the given object is larger.

Type
number

equals(other) → {Boolean}

Returns true if the objects are the same, false otherwise.

Parameters:
Name Type Description
other LocalTime
Source:
Returns:
Type
Boolean

(package) getInternal() → {rust.LocalTimeWrapper}

Source:
Returns:
Type
rust.LocalTimeWrapper

getTotalNanoseconds() → {Long}

Gets the total amount of nanoseconds since midnight for this instance.

Source:
Returns:
Type
Long

inspect() → {string}

Provide the name of the constructor and the string representation

Source:
Returns:
Type
string

toBuffer() → {Buffer}

Returns a big-endian bytes representation of the instance

Source:
Returns:
Type
Buffer

toJSON() → {string}

Gets the string representation of the instance in the form: hh:MM:ss.ns

Source:
Returns:
Type
string

toString() → {string}

Returns the string representation of the instance in the form of hh:MM:ss.ns

Source:
Returns:
Type
string

(static) fromBuffer(value) → {LocalTime}

Creates a new instance of LocalTime from the bytes representation.

Parameters:
Name Type Description
value Buffer
Source:
Returns:
Type
LocalTime

(static) fromDate(date, nanosecondsopt) → {LocalTime}

Uses the provided local time (in milliseconds) and the nanoseconds to create a new instance of LocalTime

Parameters:
Name Type Attributes Default Description
date Date

Local date portion to extract the time passed since midnight.

nanoseconds Number <optional>
0

A Number from 0 to 999 999 999 representing the nanosecond time portion.

Source:
Returns:
Type
LocalTime

(static) fromMilliseconds(milliseconds, nanosecondsopt) → {LocalTime}

Uses the provided local time (in milliseconds) and the nanoseconds to create a new instance of LocalTime

Parameters:
Name Type Attributes Default Description
milliseconds Number

A Number from 0 to 86 399 999.

nanoseconds Number <optional>
0

A Number from 0 to 999 999 999 representing the time nanosecond portion.

Source:
Returns:
Type
LocalTime

(package, static) fromRust(arg) → {LocalTime}

Get LocalTime from rust object. Not intended to be exposed in the API

Parameters:
Name Type Description
arg rust.LocalTimeWrapper
Source:
Returns:
Type
LocalTime

(static) fromString(value) → {LocalTime}

Parses a string representation and returns a new LocalDate.

Parameters:
Name Type Description
value string

accepted format: hh:MM:ss.ns

Source:
Returns:
Type
LocalTime

(static) now(nanosecondsopt) → {LocalTime}

Uses the current local time (in milliseconds) and the nanoseconds to create a new instance of LocalTime

Parameters:
Name Type Attributes Default Description
nanoseconds Number <optional>
0

A Number from 0 to 999 999 999 representing the time nanosecond portion.

Source:
Returns:
Type
LocalTime