發表文章

目前顯示的是有「SQOL」標籤的文章

實用的 SOQL 相對日期 Relative Range of Time

常用重點摘要 YESTERDAY Range: Starts 00:00:00 UTC the day before and continues for 24 hours.  Example: SELECT Id FROM Account WHERE CreatedDate = YESTERDAY TODAY Range: Starts 00:00:00 UTC of the current day and continues for 24 hours. Example: SELECT Id FROM Account WHERE CreatedDate > TODAY TOMORROW Range: Starts 00:00:00 UTC after the current day and continues for 24 hours. Example: SELECT Id FROM Opportunity WHERE CloseDate = TOMORROW LAST_N_DAYS:n For the number n provided, starts with the current day and continues for the past n days. This range includes the current day, not just previous days. For example, LAST_N_DAYS:1 includes yesterday and today. Example: SELECT Id FROM Account WHERE CreatedDate = LAST_N_DAYS:365 LAST_N_YEARS:n Starts 00:00:00 UTC on January 1 of the previous year and continues through the end of December 31 of the previous nth year. Example: SELECT Id FROM Opportunity WHERE CloseDate > LAST_N_YEARS:5 參考資料 Date Formats and Date Literals in WHERE