日期範圍
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
您可以使用 Google Ads 查詢語言,透過下列方式指定日期範圍:
自訂日期範圍
您可以採用 ISO 8601 擴充 (YYYY-MM-DD
) 或基本 (YYYYMMDD
) 格式指定日期,例如:
segments.date BETWEEN '2024-01-01' AND '2024-01-31'
segments.date >= '20241001' AND segments.date <= '20241031'
預先定義的日期範圍
以下是有效的預先定義日期範圍清單:
日期範圍 |
報表產生時間... |
TODAY |
僅限今天。 |
YESTERDAY |
僅限昨天。 |
LAST_7_DAYS |
過去 7 天 (不含今天)。 |
LAST_BUSINESS_WEEK
|
前一個工作週的 5 個工作天,也就是週一到週五。 |
THIS_MONTH |
當月的所有日期。 |
LAST_MONTH |
上個月的所有日期。 |
LAST_14_DAYS |
過去 14 天 (不含今天)。 |
LAST_30_DAYS |
過去 30 天 (不含今天)。 |
THIS_WEEK_SUN_TODAY
|
上週日到當天之間的期間。 |
THIS_WEEK_MON_TODAY
|
上週一到當天之間的期間。 |
LAST_WEEK_SUN_SAT |
從上週日開始的 7 天。 |
LAST_WEEK_MON_SUN |
從上週一開始的 7 天。 |
範例:
segments.date DURING LAST_30_DAYS
預先定義的時間範圍
部分日期欄位是指預先定義的時間範圍,具體來說:
segments.week
segments.month
segments.quarter
篩選這些區隔時,您可以使用 =
運算子,並輸入時間範圍的第一天。如果您指定的日期不是週期的第一天,系統會傳回 MISALIGNED_DATE_FOR_FILTER
錯誤。
舉例來說,如要指定 2024 年 5 月,請使用下列條件,並指定該月的第一天:
segments.month = '2024-05-01'
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-27 (世界標準時間)。
[null,null,["上次更新時間:2025-08-27 (世界標準時間)。"],[[["\u003cp\u003eGoogle Ads Query Language allows you to specify date ranges using custom dates, predefined date ranges like \u003ccode\u003eTODAY\u003c/code\u003e or \u003ccode\u003eLAST_30_DAYS\u003c/code\u003e, and predefined time periods for week, month, or quarter.\u003c/p\u003e\n"],["\u003cp\u003eCustom date ranges can be defined using ISO 8601 format, either extended (\u003ccode\u003eYYYY-MM-DD\u003c/code\u003e) or basic (\u003ccode\u003eYYYYMMDD\u003c/code\u003e), within a \u003ccode\u003eBETWEEN\u003c/code\u003e or \u003ccode\u003e>=\u003c/code\u003e and \u003ccode\u003e<=\u003c/code\u003e clause.\u003c/p\u003e\n"],["\u003cp\u003ePredefined date ranges provide shortcuts for common timeframes, such as \u003ccode\u003eLAST_BUSINESS_WEEK\u003c/code\u003e or \u003ccode\u003eTHIS_MONTH\u003c/code\u003e, simplifying date selection in queries.\u003c/p\u003e\n"],["\u003cp\u003eWhen filtering by predefined time periods (week, month, quarter), use the \u003ccode\u003e=\u003c/code\u003e operator with the first day of the period to avoid errors.\u003c/p\u003e\n"]]],[],null,["# Date Ranges\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThe Google Ads Query Language lets you specify the date range in these ways:\n\n- [Custom date range](#custom)\n- [Predefined date range](#date-range)\n- [Predefined time period](#time-period)\n\nCustom date range\n-----------------\n\nYou can specify dates in [ISO 8601](//en.wikipedia.org/wiki/ISO_8601) extended\n(`YYYY-MM-DD`) or basic (`YYYYMMDD`) format, for example: \n\n segments.date BETWEEN '2024-01-01' AND '2024-01-31'\n\n segments.date \u003e= '20241001' AND segments.date \u003c= '20241031'\n\nPredefined date range\n---------------------\n\nThe list of valid predefined date ranges is as follows:\n\n| Date range | Reports are generated for... |\n|-----------------------|--------------------------------------------------------------------------------|\n| `TODAY` | Today only. |\n| `YESTERDAY` | Yesterday only. |\n| `LAST_7_DAYS` | The last 7 days not including today. |\n| `LAST_BUSINESS_WEEK` | The 5 day business week, Monday through Friday, of the previous business week. |\n| `THIS_MONTH` | All days in the current month. |\n| `LAST_MONTH` | All days in the previous month. |\n| `LAST_14_DAYS` | The last 14 days not including today. |\n| `LAST_30_DAYS` | The last 30 days not including today. |\n| `THIS_WEEK_SUN_TODAY` | The period between the previous Sunday and the current day. |\n| `THIS_WEEK_MON_TODAY` | The period between the previous Monday and the current day. |\n| `LAST_WEEK_SUN_SAT` | The 7-day period starting with the previous Sunday. |\n| `LAST_WEEK_MON_SUN` | The 7-day period starting with the previous Monday. |\n\nExample: \n\n segments.date DURING LAST_30_DAYS\n\nPredefined time period\n----------------------\n\nSome date fields refer to a predefined period of time, specifically:\n\n- `segments.week`\n- `segments.month`\n- `segments.quarter`\n\nWhen filtering on these segments, you can use the `=` operator with the date\nthat is the first day of the time period. If you specify a date that isn't the\nfirst day of a period, a `MISALIGNED_DATE_FOR_FILTER` error is returned.\n\nFor example, to specify the month of May in the year 2024, use the\nfollowing condition, specifying the first day of that month: \n\n segments.month = '2024-05-01'"]]