AnsweredAssumed Answered

Date vs datetime datatype: differences

Question asked by lmattioli1 on May 10, 2017
Latest reply on May 15, 2017 by afaust

After a bit of testing, I think I found that there's only one difference: in Share edit/visualization mode the datetime shows/asks for the time.
In the DB the value is always stored as a datetime WITH a Timezone.

Here's an example. I've three properties associated to the same node_id, the first is a datetime, the other two are date

string_value
2017-12-22T14:56:00.000Z
2017-05-22T22:00:00.000Z
2017-05-17T22:00:00.000Z

Tomcat is setted with Rome Timezone, so +2 hours in SummerTime and +1 hour in Winter.
I've tried both by browser and via CMIS: you get the same result.

Here's the respective values that I've typed

2017-12-22 15:56 (+1 hour)
2017-05-23 (+2 hours)
2017-05-18 (+2 hours)

This mean that if you want to make a query via CMIS on a date field, you've to worry about Timezone.
Is this correct? I don't know, I think that there's no right response to the question.
At least now we're warned.

 

Personally, I don't like have a Timezone in a Date field, I'd prefer something like the LocalDate object implemented in Java 8 https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html

Outcomes