Hello All,
I have the time 9/11/2024 7:12:17 PM (mm/dd/yyyy hh:mm:ss tt format -12 hours format)
I want to compare the current time to the above time and return true if the gap between the current time and the above time is greater than 2 hours.
Thank you
try below approach
givenDate = DateTime.ParseExact(“9/11/2024 7:12:17 PM”, “M/d/yyyy h:mm:ss tt”, System.Globalization.CultureInfo.InvariantCulture)
currentDate = DateTime.Now
timeDifference = (currentDate - givenDate).TotalHours
Hi @Hansen_Clyde_Lobo
Use multiple assign activity to calculate it
- inputTime = DateTime.ParseExact(“9/11/2024 7:12:17 PM”, “M/d/yyyy h:mm:ss tt”, System.Globalization.CultureInfo.InvariantCulture)
- currentTime = Now
- timeDifference = currentTime - inputTime
- isGreaterThan2Hours = timeDifference.TotalHours > 2
in writeline print
- isGreaterThan2Hours.ToString
Hi @Hansen_Clyde_Lobo
Please find my solution
TimeDifference.zip (1.7 KB)
1 Like
system
(system)
Closed
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.