MidDate
詳細とオプション
- MidDateは,与えられた日付または日付のリストの途中までの日付を与える.
- MidDate[datespec,…]の datespec の可能な形には以下がある.
-
DateObject[…] 任意の粒度の日付オブジェクトの中間の日付 TimeObject[…] 任意の粒度の時間オブジェクトの中間の時点 DateInterval[…] 日付区間の中間の日付 {d1,d2,…} 日付,時,区間のリストの中間の日付 TimeSeries[…] 時系列の時間の中間の日付 EventSeries[…] 事象系列の時間の中間の日付 TemporalData[…] 一時データの時間の中間の日付 - MidDate[{d1,d2,…}]は,di日の日付の一様分布の確率密度関数の和に基づいて,中点の瞬間を与える.
- MidDateは次のオプションを取る.
-
CalendarType Automatic 生成された日付の暦 DateFormat Automatic 日付の表示に使う形式 DateGranularity Automatic 生成された日付の暦粒度 Method Automatic 中点検出メソッド TimeSystem Automatic 使用されている時間系 TimeZone Automatic 使用されている時刻帯 - MidDate[list,…,Methodmethod]のMethodオプションの値 method は,di日の日付の中間日の計算方法を決定する.次は,Methodの可能な値である.
-
"GranularMean" 粒度の長さによる重み付き平均(デフォルト) "GranularMedian" 粒度の長さによる重み付き中央値 "WeightedMean" 各データの完全な継続期間による重み付き重心 "UnionedMean" すべての日付の統合された領域の平均 "MidpointMean" 中点の平均 "MidpointMedian" 中点の中央値 "BoundsMean" 日付境界の平均
例題
すべて開く すべて閉じる例 (4)
MidDate[DateObject[{2024, 9}, "Month", "Gregorian", -5.]]MidDate[DateObject[{2024}, "Year", "Gregorian", -5.], "Day"]MidDate[DateObject[{2024, 9, 30}, "Week", "Gregorian", -5.], "Hour", 2 / 3]MidDate[{DateObject[{2024, 12, 30, 18, 1, 56.774}, "Instant", "Gregorian", -5.], DateObject[{2024, 4, 8, 12, 54, 47.1752}, "Instant", "Gregorian", -5.], DateObject[{2024, 8, 13, 22, 45, 35.5214}, "Instant", "Gregorian", -5.]}]スコープ (7)
入力のリストについて,中点はリスト中の各日付の暗黙の区間に基づいて取られる:
dates = {DateObject[{2024, 10, 1}, "Day"], DateObject[{2024, 10, 3}, "Day"]};mid = MidDate[dates, "Day"]TimelinePlot[{DateInterval /@ dates, {DateInterval@mid}}]粒度が粗い中間の日付については,たとえ最初の日付より前の場合でも,与えられた日付が中間点を包含するインスタンスに対応する:
MidDate[{DateObject[{2024, 10, 3}, "Day"], DateObject[{2024, 10, 5}, "Day", "Gregorian", -5.], DateObject[{2024, 10, 5}, "Day"]}, "Month"]EventSeriesの中間の日付を求める:
ts = EarthquakeData[All, 8, {{2020, 1, 1}, {2022, 5, 16}}, "Magnitude"]MidDate[ts]Databinの中間の日付を求める:
MidDate[Databin["1qGFQ8v"]]Associationの中間の日付を求める:
MidDate[<|"date1" -> DateObject[{2024, 9, 22}, "Day"], "date2" -> DateObject[{2024, 4, 24}, "Day"], "date3" -> DateObject[{2024, 10, 28}, "Day"]|>]RandomTime[5, DateGranularity -> "Minute"]//MidDateDateInterval /@ RandomDate[{3, 2}]MidDate[%]オプション (9)
CalendarType (1)
DateFormat (1)
Method (5)
デフォルトの中点検出法("GranularMean")は,中点を選択する際に粒度の長さを考慮する:
MidDate[{DateObject[{2024, 10, 1}, "Day"], DateObject[{2024, 10, 7}, "Week"]}]これは,1週間の期間は単一の"Week"の日であろうと一続きの7つの日付("Day")であろうと重みが等しいことを意味する:
MidDate[{DateObject[{2024, 10, 1}, "Day"], DateObject[{2024, 10, 7}, "Day"], DateObject[{2024, 10, 8}, "Day"], DateObject[{2024, 10, 9}, "Day"], DateObject[{2024, 10, 10}, "Day"], DateObject[{2024, 10, 11}, "Day"], DateObject[{2024, 10, 12}, "Day"], DateObject[{2024, 10, 13}, "Day"]}]"WeightedMean"法は,粒度だけでなく各日付の完全な長さを考慮する:
MidDate[{DateObject[{2024, 2}, "Month"], DateObject[{2024, 4}, "Month"]}, "Day"]MidDate[{DateObject[{2024, 2}, "Month"], DateObject[{2024, 4}, "Month"]}, "Day", Method -> "WeightedMean"]"Median"法は,粒度に関係なくすべての日付に同じ重みを与える:
MidDate[{DateObject[{2024, 2}, "Month"], DateObject[{2024, 10, 4}, "Day"]}, "Day"]MidDate[{DateObject[{2024, 2}, "Month"], DateObject[{2024, 10, 4}, "Day"]}, "Day", Method -> "MidpointMedian"]MidDate[{DateObject[{2024, 2}, "Month"], DateObject[{2024, 11}, "Month", "Gregorian", -5.]}, "Day", Method -> "BoundsMean"]MidDate[{DateObject[{2024, 2}, "Month"], DateObject[{2024, 3}, "Month"], DateObject[{2024, 4}, "Month"], DateObject[{2024, 11}, "Month", "Gregorian", -5.]}, "Day", Method -> "BoundsMean"]中点検出法の中には粒度を重視するものもすべての日付を同じ重みとして扱うものもある:
dates = {DateObject[{2024, 10, 1}, "Day"], DateObject[{2024, 10, 7}, "Week"]};dates8 = {DateObject[{2024, 10, 1}, "Day"], DateObject[{2024, 10, 7}, "Day"], DateObject[{2024, 10, 8}, "Day"], DateObject[{2024, 10, 9}, "Day"], DateObject[{2024, 10, 10}, "Day"], DateObject[{2024, 10, 11}, "Day"], DateObject[{2024, 10, 12}, "Day"], DateObject[{2024, 10, 13}, "Day"]};weighted = {"GranularMean", "GranularMedian", "WeightedMean"};midpoint = {"MidpointMean", "MidpointMedian"};日付が2つしか与えられていない場合,"Weighted"法は粒度を考慮し,より粗い粒度の日付に引き寄せられる:
TimelinePlot[{DateInterval /@ dates, Splice[{MidDate[dates, Method -> #]}& /@ weighted]}, PlotLegends -> Prepend[weighted, "intervals"], ImageSize -> 300]より粗い粒度が個々の日付に分割されても"Weighted"法は一貫している:
TimelinePlot[{DateInterval /@ dates8, Splice[{MidDate[dates8, Method -> #]}& /@ weighted]}, PlotLegends -> Prepend[weighted, "intervals"], ImageSize -> 300]中点法はすべての日付に同等に重みを置くので,粒度の違いは考慮しない:
TimelinePlot[{DateInterval /@ dates, Splice[{MidDate[dates, Method -> #]}& /@ midpoint]}, PlotLegends -> Prepend[midpoint, "intervals"], ImageSize -> 300]個々の日付に分割すると.これらの中点法は右側に引き寄せられる:
TimelinePlot[{DateInterval /@ dates8, Splice[{MidDate[dates8, Method -> #]}& /@ midpoint]}, PlotLegends -> Prepend[midpoint, "intervals"], ImageSize -> 300]"WeightedMean"と"UnionedMean"はどちらも日付の全期間を考慮するが,"WeightedMean"は重なり合う期間を考慮するのに対し,"UnionedMean"はすべての期間を平坦化する:
oct = {DateObject[{2024, 10}, "Month"], DateObject[{2024, 10, 7}, "Week"]};mean = {"WeightedMean", "UnionedMean"};TimelinePlot[{DateInterval /@ oct, Splice[{MidDate[oct, Method -> #]}& /@ mean]}, PlotLegends -> Prepend[mean, "intervals"], ImageSize -> 300]TimeSystem (1)
アプリケーション (1)
特性と関係 (1)
Mean,Median,Quantile,CentralFeatureはすべて異なるメソッドを使って中間の日付を求める:
dates = {DateObject[{2024, 10, 20}, "Day"], DateObject[{2024, 10, 4, 15, 39, 20.336531}, "Instant", "Gregorian", -5.], DateObject[{2024, 10, 5}, "Day"], DateObject[{2024, 10, 1}, "Day"]};MidDate[dates]Mean[dates]Median[dates]Quantile[dates, .5]考えられる問題 (1)
MidDateは,数のリストを,単一の日付リストとしてではなく,絶対時間のリストとして解釈する.
list = DateList[]MidDate[list]MidDate[DateObject[list]]関連するガイド
-
▪
- 日付と時刻
テキスト
Wolfram Research (2025), MidDate, Wolfram言語関数, https://reference.wolfram.com/language/ref/MidDate.html.
CMS
Wolfram Language. 2025. "MidDate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MidDate.html.
APA
Wolfram Language. (2025). MidDate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MidDate.html
BibTeX
@misc{reference.wolfram_2026_middate, author="Wolfram Research", title="{MidDate}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/MidDate.html}", note=[Accessed: 03-December-2026]}
BibLaTeX
@online{reference.wolfram_2026_middate, organization={Wolfram Research}, title={MidDate}, year={2025}, url={https://reference.wolfram.com/language/ref/MidDate.html}, note=[Accessed: 03-December-2026]}