I have an Object (aObject) contains datetime field, I want to get all data from aObject where datetime includes 12-29-2013 ignoring the time.
any idea ?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
You have 2 options for doing this directly in the SOQL query.
If you know the date you want to use "Literally" you could use a date literal:
select id,name from aObject where datetimefield = YESTERDAY;
Or, you would have to use a range of datetime values:
enter DateTime startOfDT = DateTime.newInstance(2013,12,29,0,0,0); DateTime endOfDT = DateTime.newInstance(2013,12,29,23,59,59); List<Case> cases = [ select id from Case where createdDate >= :startOfDT and createdDate <= :endOfDT];