neotime: Nanosecond Temporal Types

1.7.4 · abandoned · verified Thu Apr 16

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.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create nanosecond-precision DateTime and Duration objects, perform basic arithmetic with them, and access their individual components.

from neotime import DateTime, Duration

# Create a DateTime object
now = DateTime.now()
print(f"Current nanosecond-precision time: {now}")

# Create a Duration object
delta = Duration(days=1, seconds=3600, nanoseconds=500_000_000)
print(f"A duration: {delta}")

# Perform arithmetic
future_time = now + delta
print(f"Time in the future: {future_time}")

# Access components
print(f"Year: {now.year}, Nanosecond: {now.nanosecond}")

view raw JSON →