user564963
user564963

Reputation: 2294

getting next two weeks from the current date

I am able to display the calendar (dates) of this month in table view and I am highlighting the current date and it is working fine, but now what I want to do is to display next coming 2 weeks from the current date.

I am using the following code to get the dates of the month

NSDate *today = [NSDate date]; 
NSCalendar *calender = [NSCalendar currentCalendar];
days = [calender rangeOfUnit:NSDayCalendarUnit 
                      inUnit:NSMonthCalendarUnit 
                     forDate:today];

How to calculate the up coming two weeks from today?

Upvotes: 2

Views: 343

Answers (2)

Francois
Francois

Reputation: 10978

May be you can try with:

NSDate *inTwoWeeks = [NSDate dateWithTimeIntervalSinceNow:60*60*24*7*2]

Upvotes: 0

Ilanchezhian
Ilanchezhian

Reputation: 17478

Check my answer from this post. There you can set value for daysToAdd that you want and get the NSDate corresponding.

Upvotes: 2

Related Questions