i am fetching some tickets from service desk tool and then i have to check whether the valid date is in past or not by considering both today’s date and time. how can i check this? my bot will run after every half an hour.
You can invoke some VB code. Need to use the DateTime datatype. If you don’t know about it, you can read up on it here: VB.Net - Date & Time
Or you can use this code.
Dim inputDate as Date = Date.Parse(ticketDate)
Dim nowDate as Date = Date.Now
If (inputDate.CompareTo(nowDate) = -1){
isTicketEarlier = True
}
Else{
isTicketEarlier = False
}
End If
Use a Invoke Code activity with this code. You need to have two arguments:
- ticketDate - In - A string variable containing your date and time formatted like “3 March 2020 05:30:30 PM”
- isTicketEarlier - Out - This variable is returned as True if your input ticket date and time is earlier than the current time.
Create two variables of type DateTime: aDt and todayDt
if aDt < todayDt
then aDt is in the past
This can be performed using an if statement activity.
- Create a
DateTime
variable named TicketTime - Use If activity with the condition, TicketTime < DateTime.Now
Please see below for screenshot of example: