How to get a datetime property in orientdb3.0 in ISO 8601 format

66 Views Asked by At

I'm trying to get a datetime property from OrientDB in ISO 8601 format like "2020-05-21T09:30:00.123Z"

I apply it to database as "ALTER DATABASE DATETIMEFORMAT "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'".

When i call property of vertex as "vert.getProperty("DATE")" it return me a datetime like this "Thu May 21 14:07:00 CEST 2020"

Then i parse it to format ISO 8601:

protected Instant parseDateTimeOdb(String fechaHora) {

    Instant result = ZonedDateTime.parse(fechaHora, DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss z yyyy", Locale.ROOT)).toOffsetDateTime().toInstant();
    WriteLog.debug("La cadena de OrientDB convertida vale: " + result);

    return result;

But after parse milisecond always are "000"

How can i get this property correctly?

0

There are 0 best solutions below