實用的 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

參考資料


留言

這個網誌中的熱門文章

ISC2 CC (Certified in Cybersecurity Certification) 考試心得

Salesforce證照考試心得 (Administrator and Advanced Administrator)