Hello Team,
Is there approach to get the Current IST Time
Example :
If current IST time is between 2-6 pm then Print Afternoon
and
if the Current IST Time is between 10pm-12am then print Night
Thanks in advance
Hello Team,
Is there approach to get the Current IST Time
Example :
If current IST time is between 2-6 pm then Print Afternoon
and
if the Current IST Time is between 10pm-12am then print Night
Thanks in advance
Hi @anmita
Please take a look at this approach:
Create a variable, e.g., CurrentISTTime, of type DateTime.
Assign CurrentISTTime = DateTime.Now.AddHours(5).AddMinutes(30)
Condition: CurrentISTTime.Hour >= 14 AndAlso CurrentISTTime.Hour < 18
Message Box activity inside this branch: "Afternoon"
Else If activity:
Condition: CurrentISTTime.Hour >= 22 OrElse CurrentISTTime.Hour < 2
Message Box activity inside this branch: "Night"
Hope this helps,
Best Regards.
Hi @anmita
Assign Activity:
Left Side: utcNow (DateTime)
Right Side: DateTime.UtcNow
Assign Activity:
Left Side: istTime (DateTime)
Right Side: utcNow.AddHours(5.5)
If Activity (Condition: istTime.Hour >= 14 AndAlso istTime.Hour < 18)
Then:
- Log Message Activity: "Afternoon"
Else If Activity (Condition: istTime.Hour >= 22 OrElse istTime.Hour < 2)
Then:
- Log Message Activity: "Night"
BlankProcess8.zip (146.7 KB)
Regards,
you can use this in log message
If(Now.Hour<18 And Now.Hour>=14,"Afternoon",If(Now.Hour=<23 And Now.Hour>=22,"Night","Other parts of day"))
cheers
Hello
Actually the System Time is not set in IST(It could be Mexico Time, Etc)
Then how we can get the Time in IST
Hi @anmita
Get Current IST Time:
=> Assign → currentUtcTime = DateTime.UtcNow
=> Assign → istTime = currentUtcTime.AddHours(5).AddMinutes(30)
Else If activity
- Condition: istTime.TimeOfDay >= New TimeSpan(14, 0, 0) AndAlso istTime.TimeOfDay < New TimeSpan(18, 0, 0)
Then block:
=> Assign → timePeriod = “Afternoon”
- Condition: (istTime.TimeOfDay >= New TimeSpan(22, 0, 0) AndAlso istTime.TimeOfDay <= New TimeSpan(23, 59, 59)) ||
(istTime.TimeOfDay >= New TimeSpan(0, 0, 0) AndAlso istTime.TimeOfDay < New TimeSpan(0, 0, 0))
Then block:
=> Assign → timePeriod = “Night”
3. Message: "The current time period is " + timePeriod
Hope it helps!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.