cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Neo4j Rest API datetime data types

eapsrahal
Node

I am using neo4j REST API to create nodes and relationships. I refer following documentation.

The nodes that I am dealing with have dynamic properties. Therefore I am using following payload with parameters to create nodes.

{
  "statements" : [ {
    "statement" : "CREATE (n:Person $props)  RETURN n",
    "parameters" : {
      "props" : {
        "name" : "My Node",
        "dob" : "datetime('20211229T153000')",
        "age": 55,
        "awsome": true
      }
    }
  } ]
}

This is perfectly work with String, Integer, Boolean data types. However I need to use datetime data type for "dob" . If I use datetime function within double quotes (as in above example) neo4j treat it as string value and does not store as datatime data type. Is there a solution for this?

1 REPLY 1

glilienfield
Ninja
Ninja

From the documentation, looks like that is not a supported format. You could set the properties individually in the cypher statement and use the datetime method to convert your string representation of a date to an actual date in the SET clause.