Amazon Neptune
User Guide (API Version 2017-11-29)

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Using Native Date and Time for GLV Time Data

If you are using a Gremlin Language Variant (GLV), you must use the native date and time classes and functions provided by the programming language for Gremlin time data.

The official TinkerPop Java, Node.js (JavaScript), Python, or .NET libraries are all Gremlin Language Variant libraries.

Important

This only applies to Gremlin Language Variant (GLV) libraries. If you are using a method where you send the Gremlin query as text string, you must use the datetime() method provided by Neptune. This includes the Gremlin Console, text strings using the HTTP REST API, and any other serialization that uses Groovy. For more information, see the preceding section, Using the datetime( ) Method for Groovy Time Data.

Python

The following is a partial example in Python that creates a single property named 'date' for the vertex with an ID of '3'. It sets the value to be a date generated using the Python datetime.now() method.

import datetime g.V('3').property('date',datetime.datetime.now()).next()

For a complete example for connecting to Neptune using Python, see Using Python to Connect to a Neptune DB Instance

Node.js (JavaScript)

The following is a partial example in JavaScript that creates a single property named 'date' for the vertex with an ID of '3'. It sets the value to be a date generated using the Node.js Date() constructor.

g.V('3').property('date', new Date()).next()

For a complete example for connecting to Neptune using Node.js, see Using Node.js to Connect to a Neptune DB Instance

Java

The following is a partial example in Java that creates a single property named 'date' for the vertex with an ID of '3'. It sets the value to be a date generated using the Java Date() constructor.

import java.util.date g.V('3').property('date', new Date()).next();

For a complete example for connecting to Neptune using Java, see Using Java to Connect to a Neptune DB Instance

.NET (C#)

The following is a partial example in C# that creates a single property named 'date' for the vertex with an ID of '3'. It sets the value to be a date generated using the .NET DateTime.UtcNow property.

Using System; g.V('3').property('date', DateTime.UtcNow).next()

For a complete example for connecting to Neptune using C#, see Using .NET to Connect to a Neptune DB Instance