Google 會運用 AI 技術將內容翻譯成你偏好的語言,但可能會出錯。
meridian.data.time_coordinates.normalize_date_interval
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
將日期間隔的表示方式正規化為 date 秒的元組。
meridian.data.time_coordinates.normalize_date_interval(
date_interval: meridian.data.time_coordinates.DateInterval
) -> tuple[datetime.date, datetime.date]
這裡的日期間隔是 [start_date, end_date) 的元組,其中:
start_date 包含值,但 end_date 不含此值。
- 兩者皆為多型態,可採用以下形式:
datetime.datetime (只會使用日期元件)
datetime.date (規格化形式)
np.datetime64 (只會使用日期元件)
str (會以「YYYY-mm-dd」的格式剖析,否則會以擲回)
在所有情況下,指定的日期間隔都會正規化為 datetime.date 的元組。
Args |
date_interval
|
多型日期間隔,以便進行規格化。 |
傳回 |
代表 [start_date, end_date) 日期間隔的 date 元組。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-11-10 (世界標準時間)。
[null,null,["上次更新時間:2024-11-10 (世界標準時間)。"],[],["The function `normalize_date_interval` converts a date interval into a tuple of `datetime.date` objects. It accepts a polymorphic `date_interval` which can be a tuple containing `datetime.datetime`, `datetime.date`, `np.datetime64`, or a \"YYYY-mm-dd\" formatted `str`. It returns a tuple with `start_date` and `end_date`, where `start_date` is inclusive and `end_date` is exclusive. Only the date component is utilized for `datetime` and `np.datetime64`.\n"]]