Duration in Minutes

Working with dates and times

Calculate minutes between two datetime values

Update this query to calculate the number of minutes between the datetime and datetime2 properties of the Test node.

The difference between the two dates is the number of minutes.

cypher
MATCH (x:Test)
RETURN ??????.??????(x.datetime1,x.datetime2).??????

Enter the number of minutes:

  • ✓ 400

Hint

You will need to use the duration.between function and return the minutes value.

Solution

The answer is 400.

Run the following query to see the result:

cypher
MATCH (x:Test)
RETURN duration.between(x.datetime1,x.datetime2).minutes

Summary

In this challenge, you wrote a query to return the duration in minutes between two datetime values.

In the next module, you will learn about graph traversal during a query.