ToTime
ToTime( value )
ToTime( value )
ToTime( value )
ToTime( value )
to_time( value )
ToTime( value )
Description
The ToTime
function converts a value to a timestamp type, if possible.
Attempting to convert a value to a timestamp which has no timestamp representation results in an "invalid argument" error.
Parameters
Argument | Type | Definition and Requirements |
---|---|---|
|
Any |
The value to attempt to convert to a timestamp type. |
Examples
The query below converts the string "2015-02-20T06:30:00Z" to a timestamp.
Value result = await client.Query(
ToTime("2015-02-20T06:30:00Z")
);
FaunaTime(2015-02-20T06:30:00Z)
result, _ := client.Query(ToTime("2015-02-20T06:30:00Z"))
fmt.Println(result)
{0 63560010600 <nil>}
System.out.println(
client.query(
ToTime(Value("2015-02-20T06:30:00Z"))
).get());
2015-02-20T06:30:00Z
client.query(
q.ToTime('2015-02-20T06:30:00Z')
)
.then((ret) => console.log(ret))
Time("2015-02-20T06:30:00Z")
print(client.query(
q.to_time('2015-02-20T06:30:00Z')
))
FaunaTime('2015-02-20T06:30:00Z')
println(Await.result(
client.query(
ToTime("2015-02-20T06:30:00Z")
),
5.seconds
))
2015-02-20T06:30:00Z
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!