difference()

Get the difference between two times.

Signature

difference(otherTime: Time, units: String): Number

Description

Get the difference between two times.

Parameters

Parameter Type Required Description

otherTime

Time

Yes

Time to subtract from instance Time.

units

String

Yes

Time units:

nanoseconds
microseconds
milliseconds
seconds
minutes
hours
days

Return value

Type Description

Number

Difference between the instance time and otherTime, in units rounded to the nearest nanosecond.

Examples

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

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!