Skip to main content
Commonmark migration
Source Link

I recommend you read up on Date Formats and Date Literals in the SOQL and SOSL Reference. This resource covers several ways you can format date fields that you may find useful in the future. Specifically for your current use case:

Date Literal
LAST_N_DAYS:n

 

Range
For the number n provided, starts 00:00:00 of the current day and continues for the past n days.

 

Example
SELECT Id FROM Account WHERE CreatedDate = LAST_N_DAYS:365

I recommend you read up on Date Formats and Date Literals in the SOQL and SOSL Reference. This resource covers several ways you can format date fields that you may find useful in the future. Specifically for your current use case:

Date Literal
LAST_N_DAYS:n

 

Range
For the number n provided, starts 00:00:00 of the current day and continues for the past n days.

 

Example
SELECT Id FROM Account WHERE CreatedDate = LAST_N_DAYS:365

I recommend you read up on Date Formats and Date Literals in the SOQL and SOSL Reference. This resource covers several ways you can format date fields that you may find useful in the future. Specifically for your current use case:

Date Literal
LAST_N_DAYS:n

Range
For the number n provided, starts 00:00:00 of the current day and continues for the past n days.

Example
SELECT Id FROM Account WHERE CreatedDate = LAST_N_DAYS:365

Source Link
Adrian Larson
  • 151.4k
  • 38
  • 247
  • 431

I recommend you read up on Date Formats and Date Literals in the SOQL and SOSL Reference. This resource covers several ways you can format date fields that you may find useful in the future. Specifically for your current use case:

Date Literal
LAST_N_DAYS:n

Range
For the number n provided, starts 00:00:00 of the current day and continues for the past n days.

Example
SELECT Id FROM Account WHERE CreatedDate = LAST_N_DAYS:365