+ 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