function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Hi,
Can someone post SOQL query in apex to retrive all the opportunities created an hour ago.
Regards
Surender
Can you pls mark it as a solution for the other's benifit...
Try this,
datetime myDateTime = datetime.now().addHours(-1); List<Opportunity> oppList = [Select id, Name FROM Opportunity where CreatedDate =: myDateTime];
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
It should be like this-
datetime myDateTime = datetime.now().addHours(-1);
List<Opportunity> oppList = [Select id, Name FROM Opportunity where CreatedDate >=: myDateTime];system.debug(oppList);
It worked for me like below..
List<Opportunity> oppList = [Select id, Name FROM Opportunity where CreatedDate <=: myDateTime];system.debug(oppList);
Thanks for your replies..
G. Surender
Can you pls mark it as a solution for the other's benifit...
All Answers
Try this,
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
It should be like this-
datetime myDateTime = datetime.now().addHours(-1);
List<Opportunity> oppList = [Select id, Name FROM Opportunity where CreatedDate >=: myDateTime];
system.debug(oppList);
Hi,
It worked for me like below..
datetime myDateTime = datetime.now().addHours(-1);
List<Opportunity> oppList = [Select id, Name FROM Opportunity where CreatedDate <=: myDateTime];
system.debug(oppList);
Thanks for your replies..
Regards
G. Surender
Can you pls mark it as a solution for the other's benifit...