Class: LocalTime

types~ LocalTime

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.

Members

day :Number

Gets the second component of the time represented by the current instance, a number from 0 to 59.
Type:
  • Number

hour :Number

Gets the hour component of the time represented by the current instance, a number from 0 to 23.
Type:
  • Number

minute :Number

Gets the minute component of the time represented by the current instance, a number from 0 to 59.
Type:
  • Number

nanosecond :Number

Gets the nanoseconds component of the time represented by the current instance, a number from 0 to 999999999.
Type:
  • Number

Methods

(static) fromBuffer(value) → {LocalTime}

Creates a new instance of LocalTime from the bytes representation.
Parameters:
Name Type Description
value Buffer
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 Description
date Date Local date portion to extract the time passed since midnight.
nanoseconds Number <optional>
A Number from 0 to 999,999, representing the nanosecond time portion.
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 Description
milliseconds Number A Number from 0 to 86,399,999.
nanoseconds Number <optional>
A Number from 0 to 999,999, representing the time nanosecond portion.
Returns:
Type
LocalTime

(static) fromString(value) → {LocalTime}

Parses an string representation and returns a new LocalDate.
Parameters:
Name Type Description
value String
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 Description
nanoseconds Number <optional>
A Number from 0 to 999,999, representing the time nanosecond portion.
Returns:
Type
LocalTime

compare(other) → {number}

Compares this LocalTime with the given one.
Parameters:
Name Type Description
other LocalTime time to compare against.
Returns:
0 if they are the same, 1 if the this is greater, and -1 if the given one is greater.
Type
number

equals(other) → {Boolean}

Returns true if the value of the LocalTime instance and other are the same
Parameters:
Name Type Description
other LocalTime
Returns:
Type
Boolean

getTotalNanoseconds() → {Long}

Gets the total amount of nanoseconds since midnight for this instance.
Returns:
Type
Long

toBuffer() → {Buffer}

Returns a big-endian bytes representation of the instance
Returns:
Type
Buffer

toJSON() → {String}

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

toString() → {String}

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