cancel
Showing results for 
Search instead for 
Did you mean: 

TimeZone used by activiti?

dognose
Champ in-the-making
Champ in-the-making
Hello,

usually all Java Date-Instances are defaulted to UTC. Currently im running Activiti on my
localhost which is configured to be GMT+1.

When I now start a Task and/or Process, Activiti will store the localized-datetime (GMT+1) instead
of the utc-datetime into the database (and there, obviously all Time-Zone Information gets lost).

So I wonder, if there is no option to tell activiti to use UTC-Datetime to store all these values?
6 REPLIES 6

jbarrez
Star Contributor
Star Contributor
Activiti doesn't specify any timezone, but just uses the system timezone.
Normally when you store it in the database, the timezone is stored (or the column is stored in UTC) … so there shouldn't be a problem.

dognose
Champ in-the-making
Champ in-the-making
Activiti doesn't specify any timezone, but just uses the system timezone.
Normally when you store it in the database, the timezone is stored (or the column is stored in UTC) … so there shouldn't be a problem.

I tested this one, but this is not correct. (or im doing something wrong)

Depending on what timezone the Server is running, activiti stores the "localized" DateTime without any Information about the timezone itself.

So, for a Server running in GMT +1, Activiti would "now" store 12:20 pm as time for "END_TIME_" of an Task.

jbarrez
Star Contributor
Star Contributor
Which database are you using, because some database can't store that information (Mysql has some caveats for example)

brianok
Champ in-the-making
Champ in-the-making
I know I am reviving an old thread, but I do think there is an issue in the Oracle implementation.  I have 2 workflow servers, one set to Central Standard Time (Americas/Central) and one set to UTC (Universal).  I changed the Oracle ACT_HI_PROCINST table to be TIMESTAMP WITH TIME ZONE instead of just TIMESTAMP.  End_Time_ always displays the correct time, but the start time is always local time regardless of the timestamp (e.g., if it is 4pm CST/10pm UTC time, then the servers show the correct time, but 4pm CST/4pm UTC is logged as the START_TIME_, and 4pm CST/10pm UTC is logged as the END_TIME_.  If I keep the columns as just TIMESTAMP, then it ends up logging everything in local time, so I'll have instances that start at 10pm (on UTC server) and end at 4pm (CST server) and have a -6 hour duration.

brianok
Champ in-the-making
Champ in-the-making
FYI – I changed the Oracle create scripts to use TIMESTAMP WITH TIME ZONE instead of TIMESTAMP and added the line of code "TimeZone.setDefault(TimeZone.getTimeZone("Universal"))" to all my Activiti engine main classes and it appears to be satisfactorily now.  Obviously, this will affect any outputting of dates unless you start a different JVM with the default Timezone unchanged to use for reporting purposes only.  I couldn't find the root cause in a quick scan of the code, so I have no idea if it is the Oracle JDBC driver, Ibatis, Activiti, or the JVM causing the issue.

jbarrez
Star Contributor
Star Contributor
From how I see it, it's a JVM setting. That would make the most sense too.

Thanks for posting this bit of information. It's intriguing.