time.difference()

Get the difference between two Times.

Signature

difference(start: Time, unit: String) => Number

Description

Get the difference between two times.

Parameters

Parameter Type Required Description

start

Time

true

Time to subtract from instance Time.

unit

String

true

Time units:

nanoseconds
microseconds
milliseconds
seconds
minutes
hours
days

Return value

Type Description

Number

Difference between the provided times, in units rounded to the nearest nanosecond.

Examples

Time('2099-02-10T12:00:00.000Z').difference(Time('2099-02-01T12:00:00.000Z'), 'days')
9
\