Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I add one minutes in current NSDate of iphone and save in NSDate?

I can get current date of iphone via this code as

NSDate *currentDate = [NSDate date];
NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
[dateFormatter1 setDateFormat:@"yyyy-MM-dd HH:mm"];

NSString *dateString = [dateFormatter1 stringFromDate:currentDate];

Now I just want to increase one mint then save NSString format, how can I?

like image 898
Chatar Veer Suthar Avatar asked Feb 17 '11 10:02

Chatar Veer Suthar


1 Answers

You can use dateByAddingTimeInterval.

NSDate *currentDate = [NSDate date];
NSDate *datePlusOneMinute = [currentDate dateByAddingTimeInterval:60]; 
//60 seconds
like image 104
jlmendezbonini Avatar answered Nov 06 '22 22:11

jlmendezbonini