DayRange
詳細とオプション
- DayRangeはDateObject要素のリストを返す.
- 日付は次の形で指定することができる.
-
DateObject[…] 日付オブジェクト {y,m,d} 年,月,日 {y,m} 指定された月の最初の日 {y} y 年の最初の月の最初の日 "string" 文字列としての日付 ("Jan. 1, 2000") {y,m,d,h,m,s} 厳密な時間 time 絶対時間指定 - 次は,使用可能な日付タイプである.
-
All 任意の暦の日付(デフォルト) "Weekday" 週日とみなされる日付 "Weekend" 週末とみなされる日付 "Holiday" HolidayCalendarによる祝日 "NonHoliday" 祝日ではない日付 "BusinessDay" 祝日ではない週日 "NonBusinessDay" 祝日または週末 "WeekdayHoliday" 週日の祝日 "WeekendHoliday" 週末の祝日 "WeekendNonHoliday" 祝日ではない週末 Monday, Tuesday, … 週の特定の曜日 "EndOfMonth" 指定された月の最後の日の曜日 "BeginningOfMonth" 指定された月の最初の日の曜日 - ユダヤ暦の平日はSundayからThursdayまでである.
- DayRangeは次のオプションを取る.
-
CalendarType "Gregorian" 日付が指定された暦 HolidayCalendar {"UnitedStates","Default"} 営業日と祝日の計算に必要な部分指定と祝日の予定 "IncludeEndPoints" {True,True} date1と date2を範囲に含めるかどうか
例題
すべて開く すべて閉じる例 (4)
DayRange[Yesterday, Tomorrow]With[{first = Take[DateList[], 2]}, DayRange[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], Sunday]]DayRange[DateObject[{2022, 1, 1}], DateObject[{2022, 1, 31}], "BusinessDay"]デフォルトの祝日予定に従って,現行年のすべての祝日を出力する:
With[{firstday = DayRound[CurrentDate["Year"]]}, DayRange[firstday, DatePlus[firstday, {{1, "Year"}, {-1, "Day"}}], "Holiday"]]スコープ (1)
オプション (4)
CalendarType (1)
HolidayCalendar (2)
DayRange[{2012}, {2012, 12, 31}, "Holiday", HolidayCalendar -> "India"]CalendarData["UnitedStates"]With[{first = {2012, 4}}, DayRange[first, DatePlus[first, {{1, "Month"}}], "Holiday", HolidayCalendar -> {"UnitedStates", "NYSE"}]]With[{first = {2012, 4}}, DayRange[first, DatePlus[first, {{1, "Month"}}], "Holiday"]]アプリケーション (1)
次の合衆国大統領選挙の日(閏年11月の最初の月曜日の次の火曜日)までの日数を計算する:
nextelection[date_] := Module[{year = 4Ceiling[date[[1]] / 4], nearest},
nearest = DatePlus[DayRange[{year, 11, 1}, {year, 11, 30}, Monday][[1]], 1];
If[QuantityMagnitude[DateDifference[date, nearest]] > 0, DayCount[date, nearest], DayCount[date, DatePlus[DayRange[{year + 4, 11, 1}, {year + 4, 11, 30}, Monday][[1]], 1]]]//Floor];
nextelection[DateList[]]特性と関係 (3)
DayCountは同じ入力に対するDayRangeの出力リストの長さと同じである:
With[{first = Take[DateList[], 2]}, Length[DayRange[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], "BusinessDay", "IncludeEndPoints" -> {False, True}]] == DayCount[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], "BusinessDay"]]DayRangeは,All以外のタイプの日付指定を伴う場合は,Select文に等しい:
DayRange[{2022}, {2023}, "Weekend"] == Select[DayRange[{2022}, {2023}], DayMatchQ[#, "Weekend"]&]週末,週末ではない祝日,そして営業日が,重なり合わない3つの集合を形成する:
With[{sets = {DayRange[{2022}, {2023}, "Holiday"], DayRange[{2022}, {2023}, "Weekend"], DayRange[{2022}, {2023}, "BusinessDay"]}}, Union@@sets == ((Join@@sets)//Sort)]考えられる問題 (1)
With[{first = {2012, 7}}, DayRange[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], "Weekend"]]With[{first = {2012, 7}}, DayRange[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], "Holiday", HolidayCalendar -> {"Gregorian" -> {{True&, # == 7&, 1 ≤ # ≤ 31&}}}]]関連するガイド
-
▪
- 日付と時刻
テキスト
Wolfram Research (2012), DayRange, Wolfram言語関数, https://reference.wolfram.com/language/ref/DayRange.html (2025年に更新).
CMS
Wolfram Language. 2012. "DayRange." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/DayRange.html.
APA
Wolfram Language. (2012). DayRange. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DayRange.html
BibTeX
@misc{reference.wolfram_2026_dayrange, author="Wolfram Research", title="{DayRange}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/DayRange.html}", note=[Accessed: 12-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_dayrange, organization={Wolfram Research}, title={DayRange}, year={2025}, url={https://reference.wolfram.com/language/ref/DayRange.html}, note=[Accessed: 12-September-2026]}