SOQL to Query records created in the LAST 30 (N) days : DATE Constraint
1:27 PM
LAST_N_DAYS:20
This clause means LAST 20 Days.
Using this in a SOQL Query to fetch the List of Cases created 30 days ago, the query will be
THIS_WEEK
This clause fetches records created this week. The Week is calculated as per the notes from Salesforce as :Starts 12:00:00 on the most recent first day of the week before the current day and continues for seven full days. First day of the week is determined by your locale.
More Links and methods:
Apex Date Filters: http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_soql_select_dateformats.htm
List View Filters: https://help.salesforce.com/apex/HTViewHelpDoc?id=custom_dates.htm&language=en
This clause means LAST 20 Days.
Using this in a SOQL Query to fetch the List of Cases created 30 days ago, the query will be
List<Cases> allCases = [Select Id from Cases where CreatedDate >= LAST_N_DAYS:30];
THIS_WEEK
This clause fetches records created this week. The Week is calculated as per the notes from Salesforce as :Starts 12:00:00 on the most recent first day of the week before the current day and continues for seven full days. First day of the week is determined by your locale.
List<Cases> allCases = [Select Id from Cases where CreatedDate < THIS_WEEK];
More Links and methods:
Apex Date Filters: http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_soql_select_dateformats.htm
List View Filters: https://help.salesforce.com/apex/HTViewHelpDoc?id=custom_dates.htm&language=en
0 comments