Date

This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.

Date( str )
Date( str )
Date( str )
date( str )
Date( str )

Description

The Date function constructs a Date from an ISO 8601 formatted date string.

Date only accepts a date string. An error occurs if you include any time information.

ISO 8601 dates

Date uses Java’s Date/Time API which understands a subset of the ISO 8601 standard. Not all date strings that are ISO 8601-compliant can be parsed.

The template for dates is yyyy-MM-dd, where:

  • yyyy represents the year

  • MM represents the month, from 00 to 12

  • dd represents the day, from 00 to 31

Parameters

Parameter Type Definition and Requirements

str

String

An ISO 8601 formatted date string.

Returns

A Date type which represents the converted string.

Examples

The following query returns a Date constructed from the provided string:

try
{
    Value result = await client.Query(
        Date("1970-01-01")
    );
    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
FaunaDate(1970-01-01 12:00:00 AM)
result, err := client.Query(
	f.Date("1970-01-01"))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
{0 62135596800 <nil>}
client.query(
  q.Date('1970-01-01')
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
Date("1970-01-01")
result = client.query(
  q.date("1970-01-01")
)
print(result)
1970-01-01
Date('1970-01-01')
Date("1970-01-01")
Query metrics:
  •    bytesIn:  21

  •   bytesOut:  35

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 4ms

  •    retries:   0

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!