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
jpbenjpben 

SOQL Query Date Ranges

How do you create a SOQL query for date ranges like:

  • Current Quarter
  • Previous Quarter
  • Next Quarter
  • Previous and Current Quarter

Thanks in advance

Best Answer chosen by Admin (Salesforce Developers) 
Shivanath DevnarayananShivanath Devnarayanan

Salesforce has this feature called Date Literals,

 

The are logical representation of Date that be used in SOQL or Formulas or reports

 

Example

 

Select Id from Account WHERE CreatedDate > YESTERDAY

 There are Many more that you could use : Check here : http://goo.gl/yBkebU

 

 

All Answers

Shivanath DevnarayananShivanath Devnarayanan

Salesforce has this feature called Date Literals,

 

The are logical representation of Date that be used in SOQL or Formulas or reports

 

Example

 

Select Id from Account WHERE CreatedDate > YESTERDAY

 There are Many more that you could use : Check here : http://goo.gl/yBkebU

 

 

This was selected as the best answer
jpbenjpben

Thank you