Hi.. Welcome back..
I always had issues with SOQL Query utilizing dates in particular. So I wanted to share some tips and tricks on writing SOQL queries using some Built in Date Functions...
Now you do your query in 2 ways:
1. Specify a date in your query such as
Select Id,CreatedDate from Account where CreatedDate=DateValue(2008-02-05)
This will return all Id's for all the Account Object that were Created 2008-02-05.
2. Do it with a Fixed Expression or Built in Function such as:
Select Id, CreatedDate from Account where CreatedDate = YESTERDAY
This will return all Id's for the Account Object that were Created yesterday.
This is called a Date Literal.
Now before we go on:
You must know the Syntax for Date in Force.com :
For DateTime the Syntax is as follows:
So Lets go into Date Literals: I took this off from the Salesforce.com Api docs...
The link is: http://www.salesforce.com/us/developer/docs/api/index.htm
Go to search and type in Date Literals... This should come up.(See Below)