PeterBurbery/DateTime

(1.0.0) current version: 1.1.0 »

A paclet that contains functions for date and time

Contributed by: Peter Cullen Burbery

This paclet extends the date and time functionality of Mathematica by adding functionality for leap years and leap days. The paclet also includes functionality for ISO week dates.

Installation Instructions

To install this paclet in your Wolfram Language environment, evaluate this code:
PacletInstall["PeterBurbery/DateTime"]

Details

The paclet has an image of a strontium lattice optical clock with a femtosecond comb at NIST. The link to the image on Wikimedia Commons is at the bottom.

Examples

Basic Examples (14) 

Do the computation for the next leap year:

In[1]:=
NextLeapYear[Today]
Out[1]=

Do the computation for the previous leap year:

In[2]:=
PreviousLeapYear[Today]
Out[2]=

Do the computation to find what year will be 1000 leap years from now:

In[3]:=
DatePlusLeapYear[1000]
Out[3]=

Do the computation to find what year was 10 000 leap years ago:

In[4]:=
DatePlusLeapYear[-10000]
Out[4]=

Build a table of leap years up to 54:

In[5]:=
LeapYearRange[54]
Out[5]=

Build a table of leap years before 1600:

In[6]:=
LeapYearRange[(DateObject[{1600}, "Year"]), -148]
Out[6]=

Find the leap year day, or Bissext or bissextus in a leap year:

In[7]:=
LeapYearDay[DateObject[{1584}, "Year"]]
Out[7]=

Find the next leap year day:

In[8]:=
NextLeapYearDay[]
Out[8]=

Find the previous leap day:

In[9]:=
PreviousLeapYearDay[]
Out[9]=

Add and take away leap days:

In[10]:=
DatePlusLeapYearDay[403]
Out[10]=
In[11]:=
DatePlusLeapYearDay[(DateObject[{2022, 5, 2, 9, 16, 19.089397430419922`}, "Instant", "Gregorian", -5.`]), 403]
Out[11]=
In[12]:=
DatePlusLeapYearDay[(DateObject[{2022, 5, 2, 9, 16, 19.089397430419922`}, "Instant", "Gregorian", -5.`]), -1096]
Out[12]=

List leap days:

In[13]:=
LeapYearDayRange[21]
Out[13]=
In[14]:=
LeapYearDayRange[(DateObject[{2104}, "Year"]), 21]
Out[14]=
In[15]:=
LeapYearDayRange[(DateObject[{2188}, "Year"]), -54]
Out[15]=

Find the ISO Week Day string:

In[16]:=
ISOWeekDate[]
Out[16]=

Find the date for Christmas in 2022:

In[17]:=
ISOWeekDate[DateObject[{2022, 12, 25}, "Day"]]
Out[17]=

Find a date object from an ISO Week Date list:

In[18]:=
FromISOWeekDate[{2022, 51, 7}]
Out[18]=

Publisher

Peter Burbery

Compatibility

Wolfram Language Version 13.2

Version History

  • 1.1.0 – 29 December 2022
  • 1.0.0 – 28 December 2022

License Information

MIT License

Paclet Source

Source Metadata