Date.fromString()

Construct a Date from a date String.

Signature

Date.fromString(date: String) => Date

Description

The Date.fromString() method converts a YYYY-MM-DD date 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 Date.fromString().

Parameters

Parameter Type Required Description

date

String

true

Date String in the form yyyy-MM-dd.

Return value

Type Description

Date

Date converted from string representation of the date.

Examples

Convert a date string to a Date:

Date.fromString("2099-10-20")
Date("2099-10-20")
\