cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Round a timestamp to nearest day

Everything is in the title,

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

1 ACCEPTED SOLUTION

WITH datetime.truncate('day', datetime({epochSeconds: 1625726538})) AS date
RETURN *

View solution in original post

3 REPLIES 3

Hello @tard.gabriel

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

Regards,
Cobra

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
RETURN *
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online