I need to check whether lastdate is within 12hours from currdate. Please suggest how to code it.
lastdate is a string variable
currdate is a datetime variable
For Example: if lastdate is 12/15/2023 15:19:30 and currdate is 12/15/2023 17:20:21, lastdate is within 3 hours from currentdatetime then my if condition should result in true. if lastdate is 12/15/2023 15:19:30 and currdate is 12/15/2023 20:20:21, lastdate is beyond 3 hours from currentdatetime then my if condition should result in false.
@ppr suggestion is correct, but I think he missed that lastdate is a string…so you’ll need to convert it. Also, there’s no reason to assign Now to a variable.