Reputation: 2023
I am using Orientdb with Eclipse and the orientdb-client jar. I use the following statement to read out Messages:
List<ODocument> result = connection.command(
new OSQLSynchQuery<ODocument>(
"SELECT * FROM Message"))
.execute();
At first glance the results looks right, but then i realized that the time i read out from a DATTIME field is wrong. When i run the query "select * from Message ", the locahost version gives me the following results (just a part of it): When i run the java snippet from above, the results looks like :
For the formating i use a SimpleDateFormat:
DateFormat formatter = new SimpleDateFormat("HH:mm:ss a");
String time = formatter.format(each.field("Time"));
So why is the hour of the date different ( 2 hours) ? Could it be a Timezone issue?
Upvotes: 2
Views: 212
Reputation: 4685
It because database returns results in database's timezone.
You can see it from studio in section Db->configuration.
Command to update timezone looks like
alter database timezone GMT+6
Upvotes: 3