function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TraceyTracey 

SOQL Where statement on Date

How would one write a SOQL query that queries records in the last hour? 

 

 

Select n.IsPrivate, n.Id, n.CreatedDate, n.Body From Note n

where n.CreateDate.AddDate(-1, 'h')

JimRaeJimRae

Something like this should work:

 

 

select n.IsPrivate, n.Id, n.CreatedDate, n.Body From Note n where n.CreatedDate>=:datetime.now().addhours(-1)