lovepong66
(Rugpong Sirimart (Luck))
November 17, 2022, 12:56pm
1
I have data in excel like this
No problem for read data from excel but my issues i need to do something like this
=> check current time is valid period for Start_bot or not ?
Example :
current_time => 13:00
start_bot => 09:00
stop_bot => 15:30
if this case … program will be start to do tasks…
(Big Thanks for anyone who answer by and example code).
Thanks,
RajKumar_DC
(RajKumar Durai)
November 17, 2022, 1:06pm
2
Hi @lovepong66 ,
if want to convert String to time use below code
yourTimeTtring = “18:32”
CDate(“yourTimeTtring”).ToString(“HH:mm”)
which against you want to compare, try to explain with example
Thanks,
Rajkumar
postwick
(Paul Ostwick)
November 17, 2022, 1:08pm
3
That doesn’t convert it to time. That converts it to date and back to string.
The correct solution is TimeSpan.Parse
lovepong66
(Rugpong Sirimart (Luck))
November 17, 2022, 2:13pm
4
In my case … i create .bat file for execute UiPath to autorun script (imagine something like cronjob)
after program execution before to do anything i would like to create function to checking before start the process… see image at below
in details
09:00 and 15:30 just like a config for control time period for my system because i don’t want
my server or my computer to work too hard.
Thanks,
1 Like
ppr
(Peter Preuss)
November 17, 2022, 2:34pm
5
Now.TimeOfDay >= Cdate("09:00").TimeOfDay And Now.TimeOfDay <= Cdate("15:30").TimeOfDay
As well agreed to use Timespan as we can reduce the code chars
Now.TimeOfDay >= Timespan.Parse("09:00") And Now.TimeOfDay <= Timespan.Parse("15:30")
3 Likes
lovepong66
(Rugpong Sirimart (Luck))
November 18, 2022, 2:24am
6
Good idea for solved thank you very much
by the way i’m a newbie so i think someone who is now for newbie might be not clear about your
answers so… then i have to attach some detail over here
*** important ***
The datatype of variable must be set to TimeSpan
IF something not clear please download a file.
test_time_period.xaml (7.9 KB)
thank you everyone,
Have a good day
system
(system)
Closed
November 21, 2022, 2:24am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.