With the support of datetime types in Neo4j, users might wonder how or if it works to transport those types along with other data types via the drivers.
It is possible and supported to send temporal objects using one of our Neo4j drivers. We will show how to do that here.
Passing objects in Drivers
The Neo4j drivers export nearly all of the supported Cypher data types, including temporal types. This means that you can send an object of parameters containing strings, numbers, dates/times, and mixed value types back and forth between the database and applications.
For a full list of the supported Cypher types in the Neo4j drivers, check out the documentation page on the Cypher type system.
In the example above, we created a constant of a date type, instantiating the value in the variable definition. Our next statement runs a Cypher
CREATE and passes in a String value for the
name parameter and our date constant for the
Our Cypher statement references the parameters by using the
$ in front of the parameter name.
This avoids having to convert values from Strings using the
date() function within the Cypher statement like the example below.