• SFDC Dev-admin
  • 5 Points
  • Member since 2014

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1
I am having the following problem. When I use TODAY literal in my SOQL statements comparing with ActivityDate for some reason the records where date = tomorrow are returned. Here are the details:

Select e.ActivityDate, e.ActivityDateTime, e.Id, e.Subject from Event e  
Where e.OwnerId = '<myId>' AND e.ActivityDate = TODAY

Today is 05/18/2007

The statement does not return events where ActivityDate is 05/18/2007. Instead in returns events where ActivityDate is 05/19/2007.

When I filter by a Datetime field (Event.ActivityDatetime) this does not occur and correct records are returned.

For now, I just simply modified my SOQL to use YESTERDAY instead of TODAY. But I would like to know the reason for this behavior. Am I missing something here or this could be an issue?

Thank you.