System time manipulation (rounding)

Hello,

I’m working on a project where the current system time needs to treated in 5 minute segments, i.e. if the current system time is 17:47 it should be rounded to 17:45; if 17:04 → 17:00 and so on.

I know how to get the system time but not how to “round” it. Does anyone have an idea?

@RPA_user1 Do you want the round off value as a String or as a TimeSpan?

As a String, I reckon

@RPA_user1 When would you want it to round off to 17:50 ? What should be the output when the time is 17:48 or 17:49 ?

If the time is 17:51, 17:52, 17:53, or 17:54 → 17:50
If 17:48 or 17:49 → 17:45.
It should always convert to an earlier time if it does not end on 0 or 5.

@RPA_user1 Check this Workflow :
Round Off System Time.xaml (7.5 KB)

Test this Workflow at different times. And revert back if it does not give the expected output and mention the time it didn’t convert

2 Likes

Fantastic. It works as intended with this Split method! Thank you, very interesting.

1 Like

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