Course

Working with Dates and Durations

Use Neo4j temporal types to filter, compute, and search date-based data

35 minutes6 lessons across 1 module
About this lab

In this 35-minute lab, you will learn

The movies database stores release years and birth years as plain integers. These values work for simple lookups, but they cannot answer questions about time spans, date ranges, or relative ordering without manual arithmetic scattered across your queries.

In this lab, you will use Neo4j's built-in temporal types to convert those raw integers into proper date values, truncate dates for grouping and index-friendly comparisons, compute durations between events, and combine these techniques to build date range searches. By the end, you will have written a query that finds movies by actor and release window using temporal arithmetic.

You will work with the movies dataset: a graph of Movie nodes (with title, released, and tagline properties) and Person nodes (with name and born properties), connected by ACTED_IN and DIRECTED relationships.

  • Temporal types

    Understand Neo4j date, datetime, time, localtime, and localdatetime types and how to create them.

  • Date conversion and truncation

    Convert integer year properties into proper date values and truncate dates for grouping and index-friendly comparisons.

  • Durations and arithmetic

    Create durations, compute time spans between dates with duration.between(), and perform date arithmetic with + and - operators.

  • Date range searches

    Combine date conversion, truncation, and duration arithmetic to build temporal range queries that leverage indexes.