日期范围
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
借助 Search Ads 360 查询语言,您可以通过以下两种方式指定日期范围:
自定义日期范围
您可以使用 ISO 8601(YYYY-MM-DD
) 格式指定日期:
segments.date BETWEEN '2019-01-01' AND '2019-01-31'
segments.date >= '2019-01-01' AND segments.date <= '2019-01-31'
时间段
某些日期字段是指预定义的时间段,具体如下:
segments.week
segments.month
segments.quarter
在按这些细分受众群进行过滤时,您可以使用 =
运算符,并指定相应时间段的第一天作为日期。从 v9 开始,如果您指定的日期不是周期的第一天,系统会返回 MISALIGNED_DATE_FOR_FILTER
错误。
例如,如需指定 2021 年 5 月,您可以使用以下条件,指定该月份的第一天:
segments.month = '2021-05-01'
预定义日期范围
有效的预定义日期范围列表如下:
日期范围 |
所生成报告的日期范围 |
TODAY |
仅限今天。 |
YESTERDAY |
仅限昨天。 |
LAST_7_DAYS |
过去 7 天(不包含今天)。 |
LAST_BUSINESS_WEEK |
上个工作周周一至周五为期五天的时间段。 |
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
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[[["\u003cp\u003eThe Search Ads 360 Query Language allows specifying date ranges using either custom dates or predefined date ranges.\u003c/p\u003e\n"],["\u003cp\u003eCustom date ranges can be defined using ISO 8601 format and operators like \u003ccode\u003eBETWEEN\u003c/code\u003e, \u003ccode\u003e>=\u003c/code\u003e, and \u003ccode\u003e<=\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eTime period segments such as week, month, and quarter require filtering with the first day of the period using the \u003ccode\u003e=\u003c/code\u003e operator.\u003c/p\u003e\n"],["\u003cp\u003ePredefined date ranges offer shortcuts for common periods like \u003ccode\u003eTODAY\u003c/code\u003e, \u003ccode\u003eLAST_7_DAYS\u003c/code\u003e, \u003ccode\u003eLAST_MONTH\u003c/code\u003e, and others, simplifying query construction.\u003c/p\u003e\n"],["\u003cp\u003eSpecifying a date that is not the first day of a period for segments like \u003ccode\u003esegments.month\u003c/code\u003e will result in a \u003ccode\u003eMISALIGNED_DATE_FOR_FILTER\u003c/code\u003e error.\u003c/p\u003e\n"]]],["The Search Ads 360 Query Language uses custom or predefined date ranges. Custom ranges utilize ISO 8601 format (YYYY-MM-DD) for specific dates (e.g., `segments.date BETWEEN '2019-01-01' AND '2019-01-31'`). For segments like `week`, `month`, or `quarter`, filters must use the first day of the period. Predefined ranges, such as `TODAY`, `LAST_7_DAYS`, or `LAST_MONTH`, offer shortcuts (e.g., `segments.date DURING LAST_30_DAYS`).\n"],null,["# Date Ranges\n\nThe Search Ads 360 Query Language lets you specify the date range in two ways:\n\n- custom date range\n\n- predefined date range\n\nCustom date range\n-----------------\n\nYou can specify dates in ISO 8601(`YYYY-MM-DD`) format: \n\n segments.date BETWEEN '2019-01-01' AND '2019-01-31'\n\n segments.date \u003e= '2019-01-01' AND segments.date \u003c= '2019-01-31'\n\n### Time periods\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. Starting in v9, if you specify a date\nthat is not the first day of a period, a `MISALIGNED_DATE_FOR_FILTER` error is\nreturned.\n\nFor example, to specify the month of May in the year 2021, you would use the\nfollowing condition, specifying the first day of that month: \n\n segments.month = '2021-05-01'\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"]]