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.

Date()

Construct a Date from a ISO 8601 date String.

Signature

Date(date: String) => Date

Description

The Date() method converts a YYYY-MM-DD String to a Date.

The method accepts only a date String and returns an error if time information is included in the String.

Date objects render to date strings in query responses.

This method is equivalent to the Date.fromString() method.

Parameters

Parameter Type Required Description

date

String

true

Date String in the YYYY-MM-DD format.

Return value

Type Description

Date

Date representation of the string.

Examples

Convert a date string to a Date:

Date("2099-10-20")
Date("2099-10-20")

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!