I have a program that checks for the date and minute part of my job object. If these match then it triggers a particular job.
If jb.ScheduledStartTime.Value.ToString("MM/dd/yyyy mm") =
Now().ToString("MM/dd/yyyy mm") Then
'Do some work here.
End If
Issue:
If I schedule different jobs during the day at different time interval then they just work fine. I mean they are triggered and in the above code they enter the loop when it matches the current format.
However, it doesn’t work when the date changes at 12:00. Even though I have scheduled start time set to trigger at 9:00 AM in the morning it enters the loop exactly at 12:00 AM which is invalidating my logic leaving me confused.
Why is this happening? Is my date and minute checking logic incorrect here? Is there any better way of doing this?
I don’t check for exact seconds here I just check for the minute part.
Also check the hour part (HH) of the dateteime, your format should be “MM/dd/yyyy HH:mm”
try this