0

I'm bit new to SFDC development. I'm currently working on project for which I need to get records created in last 30 mins from a SObject. Note: I want do this in a single soql query.

T3chn1nja
  • 31
  • 2
  • 7

1 Answers1

1

Try this..

DateTime timeNow = System.now(); // Get the time now
DateTime X30MinutesAgo = timeNow.addMinutes(-30); // Subtract 30 minutes from it
System.DEBUG([SELECT ID FROM Account WHERE createdDate <:timeNow AND createdDate >:X30MinutesAgo]);// This will return all accounts created in the last 30 minutes
chri
  • 296
  • 1
  • 4
  • 11