Latest 1.0.0
License BSD 3-Clause
Platforms ios 5.0, requires ARC

MCDateExtensions – Having fun with NSDate.

Badge w/ Version
Badge w/ Platform

#import "NSDate+MCExtensions.h"

- (void)funWithMCDateExtensions
  NSDate* today = [NSDate date];

  // Today? Tomorrow? Yesterday?
  [today isToday]; // returns YES
  [today isYesterday]; // returns NO
  [today isTomorrow]; // returns NO

  // Compare based on day
  [today isSameDayAsDate:[NSDate date]]; // Most likely returns YES

  // Get all the details of a date
  NSDateComponents* todayBrokenDown = [today components];
  // ...with specific units
  NSDateComponents* specificUnits = [today componentsWithUnits:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay)];

  // Some fun Maths!
  NSDate* sameDayNextYear = [today dateByAddingYears:1];
  NSDate* sameDayNextQuarter = [today dateByAddingQuarters:1];
  NSDate* sameDayInTwoMonth = [today dateByAddingMonths:2];
  NSDate* sameDayNextWeek = [today dateByAddingWeeks:1];
  NSDate* yesterday = [today dateByAddingDays:-1];
  NSDate* tomorrow = [today dateByAddingHours:24];
  NSDate* nextHour = [today dateByAddingMinutes:60];
  NSDate* inTwoMinutes = [today dateByAddingSeconds:120];
  NSDate* inAFewSeconds = [today dateByAddingCalendarUnit:(NSCalendarUnitSecond) value:30];

  // Differences
  NSInteger days = [NSDate daysBetweenDate:today andDate:tomorrow]; // returns 1
  NSInteger weeks = [NSDate daysBetweenDate:today andDate:sameDayNextWeek]; // returns 1
  NSInteger months = [NSDate monthsBetweenDate:today andDate:sameDayInTwoMonth]; // returns 2
  NSInteger years = [NSDate monthsBetweenDate:today andDate:sameDayNextYear]; // returns 1

Adding to your project

If you’re using CocoaPods, there’s nothing simpler.
Add the following to your Podfile
and run pod install

pod 'MCDateExtensions', :git => ''

Don’t forget to #import "NSDate+MCExtensions.h" where it’s needed.


MCDateExtensions is © 2013-2015 Mirego and may be freely
distributed under the New BSD license.
See the file.

About Mirego

Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. We’re a team of talented people who imagine and build beautiful Web and mobile applications. We come together to share ideas and change the world.

We also love open-source software and we try to give back to the community as much as we can.

Latest podspec

    "name": "MCDateExtensions",
    "version": "1.0.0",
    "license": "BSD 3-Clause",
    "summary": "Extensions on the dates classes.",
    "homepage": "",
    "authors": {
        "Mirego, Inc.": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.0.0"
    "source_files": "MCDateExtensions/*.{h,m}",
    "requires_arc": true,
    "platforms": {
        "ios": "5.0"

Pin It on Pinterest

Share This