1

I haven't completely convinced myself of this yet, but I am starting to think that the CBugEventQuery.SetParamDate method ignores the time part of the date passed in.

The following code returns all bugevents up to, but not including the current day. If I manually edit the date in the BugEvent table to "remove the time" (aka set it to midnight), the query then returns the current day.

CBugEventQuery eventQuery = api.BugEvent.NewBugEventQuery();
....          
eventQuery.AddWhere("dt<=@LastDate");
eventQuery.SetParamDate("@LastDate", System.DateTime.Now);
...

Can someone confirm that the above query should return any event on or before the current time/date?

flag

1 Answer

2

This may be a time zone issue. All dates are stored in the database as UTC, but you're using System.DateTime.Now which could be in another time zone. Try using System.DateTime.UtcNow and see if that gives you different results.

link|flag
That was it. Good catch! – JohnFx Oct 1 2009 at 19:48

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.