TimeDiff between two Times

I have two different times in my process. I want to calculate the difference from the two times

date1 = datetime.Now.ToString(“HH:mm:ss”, New CultureInfo(“de-DE”))
date2 = datetime.Now.ToString(“HH:mm:ss”, New CultureInfo(“de-DE”))

What is the easiest way to do the calculation?

Hi @Crusha
You can check this link

Hope it help you

Mark it as solution if it resolves your query

Regards
Nived N
Happy Automation

This dont help me. I would the time difference not the date.

Hi @Crusha,

Please try (date2.Subtract(date1)).ToString("hh\:mm\:ss")

Best regards,
Marius

1 Like

i found a simpler variant: DateTime.Parse(date2).Subtract(DateTime.Parse(date1))

1 Like

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