Calendar Calculations
No more counting days on a calendar!
Adding or subtracting time from dates
10 June + 3 weeks | 1 July
April 1, 2019 − 3 months 5 days | 27 December 2018
12/02/1988 + 32 years | 12 February 2020
01.05.2005 + 3 years 2 months 3 weeks | 22 July 2008
3 weeks after March 14, 2019 | 4 April 2019
28 days before March 12 | 12 February
2 months 3 days after June 5 | 8 August
yesterday - 8 weeks 3 days | 12 July
Yesterday + 1 week | 11 JuneGetting a date relative to the present
today + 3 weeks | 1 October
now − 1 month | 5 May
4 days from now | 14 September
3 days ago | 7 SeptemberCalculations with named holidays
You can use holiday names in date calculations. For example, days until Christmas counts down to Christmas.
For holidays whose dates change each year, specify the year to find the date:
Easter 2027 → March 28, 2027
Supported holidays and special dates
Christmas: Christmas Eve, Christmas Day, Boxing Day, Orthodox Christmas
Easter: Good Friday, Holy Saturday, Easter Sunday, Easter Monday, Orthodox Good Friday, Orthodox Easter
New Year: New Year's Eve, New Year's Day, Chinese New Year's Eve, Chinese New Year
Ramadan: Ramadan (the start), End of Ramadan
Hanukkah: Hanukkah (the start), End of Hanukkah
Other dates: Valentine's Day, Halloween, Thanksgiving (US), Black Friday
These names can be used in calculations regardless of whether the dates are public holidays in your country.
Find the amount of time between two dates
Inclusive intervals of time between two dates
Week numbers (ISO 8601)
Getting parts of a date
Find a date’s position within the year or month:
day number on March 15, 2024 → 75
day of month on March 15, 2024 → 15
Without a date, day of year and day of month use today.
How many days in a month or quarter
How much of the year has passed?
Type year percentage to see how much of the current year has elapsed, expressed as a percentage.
You can also use month percentage, week percentage, or day percentage for the current month, week, or day.
Find the midpoint between two dates
Formatting dates
Use a format pattern to control how a date is displayed:
March 12, 2023 as EEEE, MMM d, yyyy → Sunday, Mar 12, 2023
Here, EEEE gives the weekday name, MMM the abbreviated month, d the day of the month, and yyyy the four-digit year.
Visit NSDateFormatter.com to learn the format symbols and experiment with your own patterns.
Notes on Ambiguity in Calendar Calculations
Ambiguous months
Unlike days and weeks, months are not clearly defined in terms of seconds. Soulver attempts to do the most logical thing given the expression. It's smart at taking into account leap years, and other calendar peculiarities:
Dates with unspecified years
A date without the year specified may use either the current year or the following year.
Last updated