Lesson Summary
In this lesson, you learned about working with temporal types in Neo4j using the Python driver:
-
The
neo4j.time
module provides classes for handling dates, times, and durations -
You can pass temporal objects as parameters or create them within Cypher statements
-
When reading temporal values from Neo4j, they are automatically converted to the appropriate Python driver types
-
Durations can be used for date arithmetic in both Python and Cypher
Converting between driver and standard library types
The Neo4j Python driver’s temporal types (like DateTime
) are different from Python’s standard library types (like datetime.datetime
). If you need to convert between them:
-
To convert from driver types to standard library: use the
.to_native()
method -
To convert from standard library to driver types: use the class constructor or
.from_native()
method