DayRound

DayRound[date,daytype]
rounds date to the nearest day of daytype, using the next-day rounding convention.

DayRound[date,daytype,rounding]
rounds date to the nearest day of daytype, using rounding.

Details and OptionsDetails and Options

  • Date can be specified in the following forms:
  • DateObject[]date object
    {y,m,d}year, month, day
    {y,m}the first day of the specified month
    {y}the first day of the first month of the year y
    "string"date as a string ()
  • DayRound returns a DateObject.
  • Possible day types are: All (default), , , Monday through Sunday, , and .
  • Recognized rounding values are: , , , , , and .
  • If date is of daytype, DayRound has no effect.
  • DayRound takes the following options:
  • CalendarType"Gregorian"calendar in which the dates have been specified
    HolidayCalendar{"UnitedStates","Default"}holiday schedule and subspecification for the business day and holiday computations
  • In the Jewish calendar, the weekdays are Sunday through Thursday.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Adjust the first of the year to the nearest following business day:

In[1]:=
Click for copyable input
Out[1]=

Determine the nearest weekend:

In[1]:=
Click for copyable input
Out[1]=

Find the nearest Sunday:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2012
(9.0)
| Updated in 2014
(10.0)