How to get Start Time of a process and End tome of a process and pass it into library

How to get Start Time of a process and End tome of a process and pass it into library.

Do we need to create a variable in the Reframework or do we can do That via library?

Hey,
I think that you need two variable:

  1. StartTime
  2. EndTime

to both you need to assign DateTime.Now.ToString()

1 Like

Hi @BHUSHAN_NAGAONKAR1

You can take assign activity at start of the process

startTime= DateTime.Now

Take another assign acitivity at end of the process

endTime= DateTime.Now

Regards,

1 Like

Can’t we just pass it in library?

Hi @BHUSHAN_NAGAONKAR1

=> Define Arguments in the Library Workflow: In the library workflow, define two In arguments to receive the start and end times.

Argument Name: in_StartTime
Direction: In
Type: DateTime

Argument Name: in_EndTime
Direction: In
Type: DateTime

=> Invoke Library Workflow in Main Process: In your main process, use the Invoke Workflow activity to call the library workflow. Pass the start and end times as arguments.

WorkflowFileName: "Path\To\Your\LibraryWorkflow.xaml"
Arguments:
  in_StartTime: dt_StartTime
  in_EndTime: dt_EndTime

=> Receive and Use Arguments in Library Workflow: In your library workflow, you can now use the in_StartTime and in_EndTime arguments to perform any necessary operations.

Log Message: "Start Time in Library: " + in_StartTime.ToString("yyyy-MM-dd HH:mm:ss")
Log Message: "End Time in Library: " + in_EndTime.ToString("yyyy-MM-dd HH:mm:ss")

Regards,

Do you mean creating the library to retrieve datetime?
Can you explain what you mean?

@BHUSHAN_NAGAONKAR1

For what you need these details?

ideally you need to pass because the activity will complete after the step and will not retain the values

cheers

So I need the to know the run time of RE process. The way we get in an Output panel and save it on excel

Hi @pikorpa I want to get runtime of RE Process in Library. I know we can pass the variable is there any alternative way we can do it?

@BHUSHAN_NAGAONKAR1

then use datetime.Now at the start and end of process and save it to variables…and use them

cheers

If I need to get the execution Time between both what should we do? Can you share variable type also?

@BHUSHAN_NAGAONKAR1

Variable type would be datetime

you can get the difference between both the variables

(EndTime-StartTime).TotalMinutes till give the elapse time in minutes in double format

cheers

1 Like

From your description is not clear if:

  • the process to check is already finished
    OR
  • the process is still running

you can check if calling ORC Rest Api can serve your use case

StartTime - TimeSpan type variable

Get start time while starting the workflow System.DateTime.Now.TimeOfDay into the StartTime variable.
On the end of the workflow you can get how long the process took (in seconds, minutes etc.):
System.DateTime.Now.TimeOfDay.Subtract(StartTime).TotalSeconds
image

It’s give you actual time it is executed.

1 Like

Also have a look at the StopWatch

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.