DayCount
詳細とオプション
- 日付は次の形で指定することができる.
-
DateObject[…] 日付オブジェクト {y,m,d} 年,月,日 {y,m} 指定された月の最初の日 {y} y 年の最初の月の最初の日 "string" 文字列としての日付 ("Jan. 1, 2000") - 次は,使用可能な日付タイプである.
-
All 任意の暦の日付(デフォルト) "Weekday" 週日とみなされる日付 "Weekend" 週末とみなされる日付 "Holiday" HolidayCalendarによる祝日 "NonHoliday" 祝日ではない日付 "BusinessDay" 祝日ではない週日 "NonBusinessDay" 祝日または週末 "WeekdayHoliday" 週日の祝日 "WeekendHoliday" 週末の祝日 "WeekendNonHoliday" 祝日ではない週末 Monday, Tuesday, … 週の特定の曜日 "EndOfMonth" 指定された月の最後の日の曜日 "BeginningOfMonth" 指定された月の最初の日の曜日 - DayCountは日付範囲の最初の日を除外する.
- DayCountは次のオプションを取る.
-
CalendarType Automatic 日付が指定された暦 HolidayCalendar {"UnitedStates","Default"} 営業日と祝日の計算に必要な部分指定と祝日の予定 - ユダヤ暦の週日はSundayからThursdayまでである.
例題
すべて開く すべて閉じる例 (4)
With[{first = Today}, DayCount[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}]]]With[{first = Yesterday}, DayCount[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], Sunday]]With[{first = Tomorrow}, DayCount[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], "BusinessDay"]]With[{first = Now}, DayCount[first, DatePlus[first, {{1, "Year"}, {-1, "Day"}}], "Holiday"]]スコープ (2)
オプション (3)
CalendarType (1)
HolidayCalendar (2)
With[{first = Take[DateList[], 1]}, DayCount[first, DatePlus[first, {{1, "Year"}, {-1, "Day"}}], "Holiday", HolidayCalendar -> "India"]]CalendarData["UnitedStates"]With[{first = DateObject[{2022, 4}]}, DayCount[first, DatePlus[first, {{1, "Month"}}], "Holiday", HolidayCalendar -> {"UnitedStates", "NYSE"}]]With[{first = DateObject[{2022, 4}]}, DayCount[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[]]特性と関係 (2)
DayCountは同じ入力に対するDayRangeの出力リストの長さと同じである:
With[{first = Today}, Length[DayRange[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], "IncludeEndPoints" -> {False, True}]] == DayCount[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}]]]祝日,週末,営業日の合計は,常にその範囲の総日数と等しくなる:
DayCount[{2022}, {2023}, "Holiday"] + DayCount[{2022}, {2023}, "Weekend"] + DayCount[{2022}, {2023}, "BusinessDay"] - DayCount[{2022}, {2023}]テキスト
Wolfram Research (2012), DayCount, Wolfram言語関数, https://reference.wolfram.com/language/ref/DayCount.html (2025年に更新).
CMS
Wolfram Language. 2012. "DayCount." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/DayCount.html.
APA
Wolfram Language. (2012). DayCount. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DayCount.html
BibTeX
@misc{reference.wolfram_2026_daycount, author="Wolfram Research", title="{DayCount}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/DayCount.html}", note=[Accessed: 05-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_daycount, organization={Wolfram Research}, title={DayCount}, year={2025}, url={https://reference.wolfram.com/language/ref/DayCount.html}, note=[Accessed: 05-September-2026]}