System Time Comparison

I have a doubt here. I need to compare my system time with three different time intervals say (6.30 AM to 3.30 PM ,3.30 PM to 11.30 PM , 11.30 PM to 6.30 AM ). And if my system time satisfied any one of the conditions i have to return a variable say (Morning,Noon and evening) respectively. For this i created a generic variable to hold the current system date and write an if activity to compare it with the time intervals above, but i dont know the syntax for checking those expressions inside.could someone help me out? Thanks in advance! :slight_smile:

// variable type of CurrentSysTime DateTime
// variable type of Basedate is DateTime
// variable type of minutes is Int64

assign CurrentSysTime = DateTime.Now
Assign Basedate = DateTime.Today
Assign minutes = DateAndTime.DateDiff(DateInterval.Minute ,Basedate, CurrentSysTime, FirstDayOfWeek.Monday,FirstWeekOfYear.Jan1)
if condition (minutes >(60**6+30) and minutes < (60*15+30)) // for morning
add more conditions

1 Like