{"id":7447,"library":"neotime","title":"neotime: Nanosecond Temporal Types","description":"neotime provides nanosecond-precision temporal types for Python, offering classes like Duration, Date, Time, and DateTime, similar to the standard library's datetime module but with enhanced precision. The library is currently abandoned, as its core temporal type implementations have been rolled into the Neo4j Python driver (version 4.0 and later). The last release was 1.7.4 in December 2018.","status":"abandoned","version":"1.7.4","language":"en","source_language":"en","source_url":"https://github.com/neo4j-drivers/neotime","tags":["time","datetime","nanoseconds","neo4j","temporal"],"install":[{"cmd":"pip install neotime","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"Date","correct":"from neotime import Date"},{"symbol":"Time","correct":"from neotime import Time"},{"symbol":"DateTime","correct":"from neotime import DateTime"},{"symbol":"Duration","correct":"from neotime import Duration"}],"quickstart":{"code":"from neotime import DateTime, Duration\n\n# Create a DateTime object\nnow = DateTime.now()\nprint(f\"Current nanosecond-precision time: {now}\")\n\n# Create a Duration object\ndelta = Duration(days=1, seconds=3600, nanoseconds=500_000_000)\nprint(f\"A duration: {delta}\")\n\n# Perform arithmetic\nfuture_time = now + delta\nprint(f\"Time in the future: {future_time}\")\n\n# Access components\nprint(f\"Year: {now.year}, Nanosecond: {now.nanosecond}\")","lang":"python","description":"This quickstart demonstrates how to create nanosecond-precision DateTime and Duration objects, perform basic arithmetic with them, and access their individual components."},"warnings":[{"fix":"For new projects or existing projects using `neo4j-driver` 4.0 or higher, remove `neotime` and use types from `neo4j.time` (e.g., `neo4j.time.DateTime`) instead.","message":"The `neotime` library has been officially abandoned. Its temporal type implementations were integrated directly into the `neo4j-driver` project starting with version 4.0. Users of `neo4j-driver` should use `neo4j.time` types instead of `neotime`.","severity":"breaking","affected_versions":"All versions (since neo4j-driver 4.0+ was released)"},{"fix":"Avoid using `neotime` for new development. If you require nanosecond-precision temporal types outside of `neo4j-driver`, consider alternative maintained libraries or implementing custom solutions.","message":"This library is no longer maintained. There will be no further updates, bug fixes, or new feature development for the standalone `neotime` package.","severity":"gotcha","affected_versions":"All versions (since 1.7.4, released Dec 2018)"},{"fix":"Ensure consistency in your codebase. If interacting with Neo4j driver 4.0+, convert `neotime` objects to `neo4j.time` objects or standard `datetime` objects before passing them to functions expecting other types.","message":"Mixing `neotime` objects with `datetime` module objects or `neo4j.time` objects can lead to `TypeError` or unexpected behavior due to differing internal representations and precision.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Implement a custom JSON encoder or convert neotime objects to standard ISO-8601 strings (e.g., `str(my_datetime)`) or Python `datetime` objects before serialization.","cause":"neotime objects are custom types and do not have a default JSON serialization method, which is common when trying to send them via APIs or save them to JSON.","error":"TypeError: 'neotime.DateTime' object is not JSON serializable"},{"fix":"Refer to the `neotime` documentation (or the `neo4j.time` documentation if you are in a Neo4j 4.0+ context) for available attributes and methods. Ensure you are importing and using the correct module for the desired types.","cause":"This error often occurs when users expect specific functionality (e.g., a constant or a utility function) that is either not part of the `neotime` API, or they are mistakenly trying to access a `neo4j.time` attribute from `neotime` (or vice-versa) after migrating.","error":"AttributeError: module 'neotime' has no attribute 'xyz'"}]}