<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Get Taskruntime</title><link>https://answers.axonivy.com/questions/2118/get-taskruntime</link><description>&lt;p&gt;Hello,
I need to know the runtime of a task in a running process.
I found a method to get a taskruntime in a process but it is not that easy I expected. Now my question, is there a less complicated way to get the runtime of a task?
My way:
It is written in the call tab of a user dialog in between 2 task symbols&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ivy.log.info("Startzeit Task "+in.startTaskTime);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is written in a script step behind the task whilst in.nummer the case nubmer is to get the last entry&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;TaskQuery  tazk = TaskQuery.create().where().name().isEqual("Task1Name");
Recordset taskZeit = ivy.wf.getTaskQueryExecutor().getRecordset(tazk.groupBy().endTimestamp());
ivy.log.info("TaskEndeZeit2: "+taskZeit.getColumn("ENDTIMESTAMP").get(in.nummer));
&lt;/code&gt;&lt;/pre&gt;</description><atom:link href="https://answers.axonivy.com/questions/2118/get-taskruntime" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 20 Oct 2016 11:25:09 -0400</lastBuildDate><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/2118/get-taskruntime/2119</link><description>&lt;pre&gt;&lt;code&gt;TaskQuery query = TaskQuery.create().where().name().isEqual("Task1Name").groupBy().endTimestamp();
ITask task = ivy.wf.getTaskQueryExecutor().getFirstResult(query) as ITask;
long taskRuntimeMillis = task.getEndTimestamp().getTime() - task.getStartTimestamp().getTime();
ivy.log.info("task runtime: "+taskRuntimeMillis);
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Thu, 20 Oct 2016 11:25:09 -0400</pubDate><guid>https://answers.axonivy.com/questions/2118/get-taskruntime/2119</guid></item></channel></rss>