+ Start a Discussion
kito kidkito kid 

records within 12 hr dynamic setting

How can I reteive only the record created within last 12 hr?


I know I can reterive for last 1 day like using below.

datetime dt = System.now()-1;


a.CreatedDate >=: dt


How can I use dyamic hour to query the SOQL?

Best Answer chosen by Admin (Salesforce Developers) 
Devender MDevender M
Hi Kito

datetime e = system.now().addHours(-12);