# How to give a time range of 8-9pm to a time like 8.30 pm (for 10.57 pm time range should be 10-11pm)?

Thank you in advance

@anjasing - Please give it a try as shown below…

Assumption: Always there is a space before AM/PM

1 Like

Hi, we want a variable timing here…like it is reading input time as system’s time including AM or PM and then converting into this. If you can suggest for same?

@anjasing - Are you looking something like this…

``````now.tostring("h:m tt").split(":"c)(0) + "-" & cint(now.tostring("h:m tt").split(":"c)(0))+1 & now.tostring("h:m tt").split(" "c)(1)
``````

Hope this helps…

1 Like

Thank you It worked. If you could help in like how to select this Time Range(if we take it as input) in a dropdown as mentioned below?

Thanks…Since this is related to UI Automation I would suggest to open up a new forum post …

Sure Thanks

could you please help in providing timerange output in this format?
Today, 3:00 PM - 4:00 PM
with same logic you’ve mentioned before? like mentioned in image

I got till this by logic
var = "Today, “+now.tostring(“h:m tt”).split(”:“c)(0) + “:00 " & now.tostring(“h:m tt”).split(” “c)(1)+” - " & cint(now.tostring(“h:m tt”).split(”:“c)(0))+1 & now.tostring(“h:m tt”).split(” "c)(1)

but not able to put 10:00 like this here

1 Like

``````"Today, " +now.tostring("h:00 tt") + " - " + now.AddHours(1).tostring("h:00 tt")
``````

Above logic will automatically add hours from the current time and identifies the PM and AM…Because if the time is 11 am then we have to add 11 am - 12 PM…similarly if its 11 PM then 11PM - 12 AM…

Please try and let me know…

3 Likes

Thank you so much It was a lot help

1 Like

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