ralphtrent
Programmer
Hi
I have a service that processes request based on a date and time. The two are seperate equations. The user can select that starting date and the ending date they want to be notified and between a start time and end time. The values are saved to a db seperatly. The time is saved as a military time converted to GMT. So 9am eastern becomes 1300 in the database.
The problem I am having is if a users END TIME is less then the users Start Time (ie 9:00 am to 8:30am, to process with in 24 hours, I read the db every 30 minutes to see what needs to be processed, hence the 30 minutes difference). This is stored in the db as 1300 and 1000 (with a -4 difference for GMT to Eastern).
When I go to compare the current time against the users selected time, I use this code :
since DateTime.UtcNow.TimeOfDay <= ltsEndTime seems to always return false (at least when testing the values I am testing with), this request will never get processed. Does anyone have idea how I can get around this?
I have a service that processes request based on a date and time. The two are seperate equations. The user can select that starting date and the ending date they want to be notified and between a start time and end time. The values are saved to a db seperatly. The time is saved as a military time converted to GMT. So 9am eastern becomes 1300 in the database.
The problem I am having is if a users END TIME is less then the users Start Time (ie 9:00 am to 8:30am, to process with in 24 hours, I read the db every 30 minutes to see what needs to be processed, hence the 30 minutes difference). This is stored in the db as 1300 and 1000 (with a -4 difference for GMT to Eastern).
When I go to compare the current time against the users selected time, I use this code :
Code:
if ((DateTime.UtcNow.TimeOfDay >= ltsStartTime && DateTime.UtcNow.TimeOfDay <= ltsEndTime))
since DateTime.UtcNow.TimeOfDay <= ltsEndTime seems to always return false (at least when testing the values I am testing with), this request will never get processed. Does anyone have idea how I can get around this?