Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

time.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('2099-02-10T12:00:00.000Z').difference(Time('2099-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!