cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.