Differences with dueDate in UserTask

Hello everybody!

I have new question.

I created a process with the following settings
image
so i fill Due date 2023-11-01T22:00:00
xml

    <bpmn:userTask id="Activity_userTask4" name="User Task 4" camunda:formKey="anyFormKey4" camunda:assignee="Ivan" camunda:dueDate="2023-11-01T22:00:00">
      <bpmn:incoming>Flow_1x9dmtj</bpmn:incoming>
      <bpmn:outgoing>Flow_0jc9xyi</bpmn:outgoing>
    </bpmn:userTask>

But in debug mode you can see different time (minus one hour)
image

my source code

List<Task> taskList = camunda.getTaskService().createTaskQuery()
      .processDefinitionId(dto.getData().getProcessDefinitionId())
      .initializeFormKeys()
      .active().list();

so my question is why camunda-engine retrieve dueDate with minus one hour?
and how can i resolve this behavior

Thank you for any ideas

Hello my friend!

Most likely the server where your Camunda engine was deployed is in a different location than your regionā€¦ for exampleā€¦ if you live in Brazil, but your Camunda was deployed on a US server, the time zone that the engine will consider is that of the United States.

To adjust this directly in your camunda project, you can create a camunda.cfg.xml file if you donā€™t already have oneā€¦ and put the following property:

Example:
If Iā€™m not mistaken, itā€™s like thisā€¦
<property name="defaultTimeZone">America/Sao_Paulo</property>

Remembering that you must adjust according to the time zone of the desired region, and also remembering that when doing thisā€¦ everyone who accesses Camunda will have the same time zone that you determined in camunda.cfg.xml.

I hope this helps!

William Robert Alves

hi my friend @WilliamR.Alves

I do all tests with that case on my local machine =)

@WilliamR.Alves help please
how can I read current default-time-zone in runtime
to check and make sure of this

And your database are in local machine too bro? :thinking:

You can do something like this in your java code:

image

Below the same code but to copy/paste :smiley:

        TimeZone defaultTimeZone = TimeZone.getDefault();
        System.out.println("Default timezone: " + defaultTimeZone.getDisplayName());

I hope this helps!

William Robert Alves

@WilliamR.Alves

System.out.println("Default timezone: " + defaultTimeZone.getDisplayName());
System.out.println("ZoneID: " + defaultTimeZone.toZoneId());

out

Default timezone: ŠœŠ¾ŃŠŗŠ²Š°, стŠ°Š½Š“Š°Ń€Ń‚Š½Š¾Šµ Š²Ń€ŠµŠ¼Ń
ZoneID: Europe/Moscow

but it is not what i need.

sorry for my incorrect question. ā€œhow can i read current default-time-zoneā€
i mean ā€œcurrent default-time-zoneā€ of camunda, which is set by camunda.cfg.xml

i donā€™t have camunda.cfg.xml, so i wanted to get default value

yes. database are in local machine too.
all environment in local machine

I donā€™t know if I understood your question well my friendā€¦
But from what I saw, it seems to me that because Camunda is a tool created on German , it must be searching for the German time zone, which is exactly one hour different from the Moscow - Russia time zone.

What I donā€™t understand is why it is doing thisā€¦ if you are running it on your local machine, I believe it was to look for the time zone of your machineā€¦ because as far as I know it looks for the timezone of the machine it is deployed on. :hushed:

William Robert Alves

In your camunda cockpit, at the bottom you can also see the time zone that is being used.

William Robert Alves

1 Like

i cannot find any related document described syntax how to set timezone in camunda.cfg.xml
do you have one?

@WilliamR.Alves

image

i have no idea =(

0300NBB0W3HR7T4:Documents ssnaran1$ docker ps
CONTAINER ID   IMAGE                    COMMAND                  CREATED       STATUS       PORTS                                                NAMES
1ed781413c00   wurstmeister/kafka       "start-kafka.sh"         5 hours ago   Up 5 hours   0.0.0.0:9092->9092/tcp                               camunda-engine-kafka
232dce557479   wurstmeister/zookeeper   "/bin/sh -c '/usr/sbā€¦"   5 hours ago   Up 5 hours   22/tcp, 2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp   camunda-engine-zookeeper
18eb04ed2110   postgres:11.7-alpine     "docker-entrypoint.sā€¦"   5 hours ago   Up 5 hours   0.0.0.0:5432->5432/tcp                               camunda-engine-postgres
0300NBB0W3HR7T4:Documents ssnaran1$ docker exec -it 18eb04ed2110 /bin/sh
/ # date
Tue Oct 24 16:59:58 UTC 2023
/ # psql -d camunda -U camunda
psql (11.7)
Type "help" for help.

camunda=# SELECT CURRENT_TIME;
    current_time    
--------------------
 17:00:03.178771+00
(1 row)

camunda=#

above docker container time and postgres time
both are UTC

Moscow is UTC+3

but my trouble is difference with 1 hour between process.xml and debug mode =(

@WilliamR.Alves

huuuum :thinking:ā€¦ this seems to be something related to dockerā€¦ try running the following command to check the time zone:

docker exec -it YOUR_DATABASE_CONTAINER_NAME psql -U DATABASE_USERNAME -d DATABASE_NAME -c ā€œSHOW TIME ZONE;ā€

(Replacing the data in bold with your real data from the application you are running.)

Take a look in this post tooā€¦ perhaps this help you:

William Robert Alves

@WilliamR.Alves i donā€™t think so. there is another problem

i posted above the same

0300NBB0W3HR7T4:~ ssnaran1$ docker exec -it 3e5d8d0cf9dd psql -U camunda -d camunda -c "SHOW TIME ZONE;"

TimeZone

----------

UTC

(1 row)

0300NBB0W3HR7T4:~ ssnaran1$

docker in UTC
database in UTC

even if you think the problem is in docker

look!

Moscow time is UTC+3

camunda runs in Moscow time
image

java runs in Moscow time

iā€™m currently at Moscow time =)

the process xml is

    <bpmn:userTask id="Activity_userTask4" name="User Task 4" camunda:formKey="anyFormKey4" camunda:assignee="Ivan" camunda:dueDate="2023-11-01T22:00:00">
      <bpmn:incoming>Flow_1x9dmtj</bpmn:incoming>
      <bpmn:outgoing>Flow_0jc9xyi</bpmn:outgoing>
    </bpmn:userTask>

image

but camunda in runtime debug mode says me

List<Task> taskList = camunda.getTaskService().createTaskQuery()
      .processDefinitionId(dto.getData().getProcessDefinitionId())
      .initializeFormKeys()
      .active().list();

image

so, we have difference in 1 hour, but not in 3 hour!

ā€œFollow up dateā€ param has the same behavior.
if i set it

What if you try a dueDate or followUpDate before 2023-10-29 02:00 ?

@GotnOGuts Hi!

the same behavior

the same. with different hours and days xD

friend, i have another case

iā€™ve created a simply process with service task type Expression.

but in debug mode it shows me MSK +4
image

is this information useful?
in other words it should be 22:13:31

so we have two cases
the first is MSK+3
the second is MSK+4

Iā€™m completely confused

Thanks!
That shows that itā€™s not some strange issue with some portion of the system thinking there was daylight savings ending (MSK doesnā€™t have DST, but other areas DO, and some of them end on the 29th at 0200)