You need to sign in to do that
Don't have an account?

How to find opportunity id for last 2 or 3 hours in soql ?
Hi All,
How to find opportunity id for last 2 or 3 hours in soql ?
I want to use this in batch apex as query string in where clause.
Currently I am using below code for retriving id for one day with help of custom setting:
=============================
from Opportunity where\t'; query += 'createddate = '+day; //custom setting
Thanks,
Subodh
How to find opportunity id for last 2 or 3 hours in soql ?
I want to use this in batch apex as query string in where clause.
Currently I am using below code for retriving id for one day with help of custom setting:
=============================
from Opportunity where\t'; query += 'createddate = '+day; //custom setting
Thanks,
Subodh
Greetings to you!
Please try below code:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
I gone through your problem, refer through these query and find opportunity id for last 2 or 3 hours :
DateTime dt = System.now().addHours(-3);
List<Opportunity> lopp = [SELECt Name FROM Opportunity WHERE CreatedDate >= :dt];
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com