Round a timestamp to nearest day

Everything is in the title,

How could I round a timestamp to nearest day, example:

Hello @tard.gabriel :slight_smile:

I guess it follows the same principle as in other languages so maybe this post will help you.


I got a part of the answer but I got this curious error:

Invalid input '(': expected an identifier character, whitespace, '.', node labels or rel types, '[', '^', '*', '/', '%', '+', '-', "=~", IN, STARTS, ENDS, CONTAINS, IS, '=', '~', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR, AS, ',', ORDER, SKIP, LIMIT, WHERE, FROM GRAPH, USE GRAPH, CONSTRUCT, LOAD CSV, START, MATCH, UNWIND, MERGE, CREATE UNIQUE, CREATE, SET, DELETE, REMOVE, FOREACH, WITH, CALL, RETURN, UNION, ';' or end of input (line 1, column 50 (offset: 49))
"WITH datetime({epochSeconds:1625726538}).truncate('day') AS date"
WITH datetime.truncate('day', datetime({epochSeconds: 1625726538})) AS date
1 Like