Enum DateTimeGroupingRuleType
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
日期時間分組規則類型
日期時間分組規則的類型。
下列範例假設試算表 locale
為「en-US」,分組值區可能會根據試算表語言代碼進行翻譯。
如要呼叫列舉,請呼叫其父項類別、名稱和屬性。例如
SpreadsheetApp.DateTimeGroupingRuleType.SECOND
。
屬性
屬性 | 類型 | 說明 |
UNSUPPORTED | Enum | 系統不支援的日期時間分組規則類型。 |
SECOND | Enum | 將日期時間依秒分組,從 0 到 59。 |
MINUTE | Enum | 將日期時間分組為 0 到 59 之間的分鐘。 |
HOUR | Enum | 使用 24 小時制 (從 0 到 23) 將日期時間分組。 |
HOUR_MINUTE | Enum | 使用 24 小時制系統,將日期時間依小時和分鐘分組,例如 19:45 。 |
HOUR_MINUTE_AMPM | Enum | 使用 12 小時制系統,將日期時間分組為小時和分鐘,例如 7:45 PM 。 |
DAY_OF_WEEK | Enum | 依星期幾將日期/時間分組,例如 Sunday 。 |
DAY_OF_YEAR | Enum | 依年內日期分組,從 1 到 366。 |
DAY_OF_MONTH | Enum | 依月日 (1 到 31) 分組日期時間。 |
DAY_MONTH | Enum | 依照日期和月份分組日期時間,例如 22-Nov 。 |
MONTH | Enum | 依月份分組日期時間,例如 Nov 。 |
QUARTER | Enum | 將日期時間分組為季度,例如 Q1 (代表 1 月至 3 月)。 |
YEAR | Enum | 依年份分組日期時間,例如 2008 年。 |
YEAR_MONTH | Enum | 依年和月分組日期時間,例如 2008-Nov 。 |
YEAR_QUARTER | Enum | 依年份和季度分組日期時間,例如 2008 Q4 。 |
YEAR_MONTH_DAY | Enum | 依年、月和日分組日期時間,例如 2008-11-22 。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003eDateTimeGroupingRuleType\u003c/code\u003e defines how date and time values are grouped in Google Sheets, like by hour, month, or year.\u003c/p\u003e\n"],["\u003cp\u003eThese grouping rules influence how data is organized and summarized, impacting features such as pivot tables and charts.\u003c/p\u003e\n"],["\u003cp\u003eYou can access these rule types using \u003ccode\u003eSpreadsheetApp.DateTimeGroupingRuleType\u003c/code\u003e followed by the specific rule, such as \u003ccode\u003eSpreadsheetApp.DateTimeGroupingRuleType.SECOND\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eGrouping buckets might be translated based on the spreadsheet's locale setting.\u003c/p\u003e\n"]]],[],null,["# Enum DateTimeGroupingRuleType\n\nDateTimeGroupingRuleType\n\nThe types of date-time grouping rule.\n\nThe examples below assume the spreadsheet [locale](/apps-script/reference/spreadsheet/spreadsheet#getSpreadsheetLocale())\nis \"en-US\", grouping bucket may be translated based on the spreadsheet locale.\n\nTo call an enum, you call its parent class, name, and property. For example, `\nSpreadsheetApp.DateTimeGroupingRuleType.SECOND`. \n\n### Properties\n\n| Property | Type | Description |\n|--------------------|--------|-----------------------------------------------------------------------------------|\n| `UNSUPPORTED` | `Enum` | A date-time grouping rule type that is not supported. |\n| `SECOND` | `Enum` | Group date-time by second, from 0 to 59. |\n| `MINUTE` | `Enum` | Group date-time by minute, from 0 to 59. |\n| `HOUR` | `Enum` | Group date-time by hour using a 24-hour system, from 0 to 23. |\n| `HOUR_MINUTE` | `Enum` | Group date-time by hour and minute using a 24-hour system, for example `19:45`. |\n| `HOUR_MINUTE_AMPM` | `Enum` | Group date-time by hour and minute using a 12-hour system, for example `7:45 PM`. |\n| `DAY_OF_WEEK` | `Enum` | Group date-time by day of week, for example `Sunday`. |\n| `DAY_OF_YEAR` | `Enum` | Group date-time by day of year, from 1 to 366. |\n| `DAY_OF_MONTH` | `Enum` | Group date-time by day of month, from 1 to 31. |\n| `DAY_MONTH` | `Enum` | Group date-time by day and month, for example `22-Nov`. |\n| `MONTH` | `Enum` | Group date-time by month, for example `Nov`. |\n| `QUARTER` | `Enum` | Group date-time by quarter, for example Q1 (which represents Jan-Mar). |\n| `YEAR` | `Enum` | Group date-time by year, for example 2008. |\n| `YEAR_MONTH` | `Enum` | Group date-time by year and month, for example `2008-Nov`. |\n| `YEAR_QUARTER` | `Enum` | Group date-time by year and quarter, for example `2008 Q4` . |\n| `YEAR_MONTH_DAY` | `Enum` | Group date-time by year, month, and day, for example `2008-11-22`. |"]]