---
title: "Modifying NSDate to represent 1 month from today"  
description: "Modifying NSDate to represent 1 month from today"  
author: "Anonymous User"  
published: 2015-08-31  
updated: 2015-08-31  
canonical: https://www.mindstick.com/forum/33430/modifying-nsdate-to-represent-1-month-from-today  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# Modifying NSDate to represent 1 month from today

I'm adding repeating [events](https://www.mindstick.com/blog/102/events-in-c-sharp) to a Cocoa app I'm working on. I have [repeat](https://www.mindstick.com/forum/156775/give-an-example-of-the-linq-repeat-method) every day and week fine because I can [define](https://yourviews.mindstick.com/audio/1110/lifestyles-choices-that-define-our-lives) these mathematically (3600*24*7 = 1 week). I use the following [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) to modify the [date](https://yourviews.mindstick.com/story/3869/propose-day-2024-exciting-date-ideas-for-you-and-your-partner):

[NSDate dateWithTimeIntervalSinceNow:(3600*24*7*(weeks))]

I know how many months have passed since the [event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) was repeated but I can't [figure](https://yourviews.mindstick.com/view/87536/what-are-ghosts-jobs-and-how-to-figure-out-them) out how to make an NSDate object that represents 1 month/3 months/6 months/9 months into the future. Ideally I want the [user](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) to [say](https://answers.mindstick.com/qa/116645/a1-wreckers-reviews-what-do-customers-say) repeat monthly [starting](https://www.mindstick.com/blog/12024/things-you-need-to-know-when-starting-your-own-business) Oct. 14 and it will repeat the 14th of every month.

## Replies

### Reply by Tarun Kumar

Use NSCalender, NSDateComponents and NSDate:

```
NSDateComponents *components = [[[NSDateComponents alloc] init]                               autorelease];components.month = 1;NSDate *oneMonthFromNow = [[NSCalendar currentCalendar] dateByAddingComponents:                          components toDate:[NSDate date] options:0];
```

Just set the different properties of components to get different periods of time (e.g. 3 months, 6 months etc).

Note: Depending on the context, you may want to use [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease] instead of [NSCalendar currentCalendar], if by "1 month" you mean "1 month on the Gregorian calendar".\


---

Original Source: https://www.mindstick.com/forum/33430/modifying-nsdate-to-represent-1-month-from-today

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
