voltdb

the time that now() function returns is different from system time


I get result as follow when I execute a sql which includes now()function in VoltDB

select * from test2;

C1                         
---------------------------
2019-06-29 07:13:38.050000 

But,I get another time when I execute a shell command 'date'

[root@localhost config]# date
Sat Jun 29 03:30:09 EDT 2019

How can I make them same?


Solution

  • VoltDB stores time in the UTC timezone. If you want to change this to EDT or any other timezone, you should be able to do it using a variety of methods and languages.

    For example, in java you might use VoltTableRow.getTimestampAsSqlTimestamp(0) to get the value of a timestamp row. You could then use DateFormat to convert this to a particular timezone.

    You can read more about the "getTimestampAsSqlTimestamp" method here: https://docs.voltdb.com/javadoc/java-client-api/org/voltdb/VoltTableRow.html

    Full Disclosure: I work at VoltDB.