Working with dates and times

Create datetime

Select the correct way to create a datetime value for May 15, 2024 at 2:30 PM.

go
import "time"

dt := time./*select:Date*/(2024, 5, 15, 14, 30, 0, 0, time.UTC)
  • ❏ Now

  • ✓ Date

  • ❏ Parse

  • ❏ Unix

Hint

Use the function that creates a specific date and time.

Solution

The correct answer is Date().

go
dt := time.Date(2024, 5, 15, 14, 30, 0, 0, time.UTC)

time.Date() creates a specific date and time with the given year, month, day, hour, minute, second, nanosecond, and location.

Lesson Summary

In this lesson, you learned how to work with temporal types in Neo4j using the Go driver.

In the next lesson, you will learn about spatial types.

Chatbot

How can I help you today?