Date.quarter
Date.quarter
功能
读取当前 Date 所在季度。
语法
date_value.quarter()
参数
无参数。
返回值
| 类型 | 说明 |
|---|---|
| Int | 返回 1 到 4 的季度序号。 |
代码示例
result = date('2026-06-09 10:11:12').quarter() // 输出:2
注意事项
- 季度按月份计算:1-3 月为 1,4-6 月为 2,7-9 月为 3,10-12 月为 4。
读取当前 Date 所在季度。
date_value.quarter()
无参数。
| 类型 | 说明 |
|---|---|
| Int | 返回 1 到 4 的季度序号。 |
result = date('2026-06-09 10:11:12').quarter() // 输出:2