Wednesday, September 2, 2015

DateTime endDate = DateTime.UtcNow.AddDays(1);

You want to run a report based on a date range, perhaps it being the last week or the last month, but the end is always the same, right now, yet it's hard to calculate when that is given a dirty hodgepodge of server time and UTC time that is the mix in your app. Well, if there are no dates in the future, you can always just set the end date in the future right? Regardless of whether the current server time or the current UTC time is later, you should be able to just take the current setting for either and then set it ahead a day to be ahead of both. (hack, hack, hack)

No comments:

Post a Comment