Hi guys!
Im doing a little app and have stuck. Im using NSDateFormatter to print out the current time, like this:
By putting a sting into an action i can get the current time:
Not to my problem.. this code gives me the current time, but i would like to withdraw 10 minutes from the current time. So if the time is 15:30 i would like to print out 15:20.
Is there any solution to my problem?
Sincerely,
Jim
Im doing a little app and have stuck. Im using NSDateFormatter to print out the current time, like this:
Code:
NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
[dateFormatter1 setDateFormat:@"HH"];
NSDate *currentDate1 = [NSDate date];
NSString *hour = [dateFormatter1 stringFromDate:currentDate1];
NSDateFormatter *dateFormatter2 = [[NSDateFormatter alloc] init];
[dateFormatter2 setDateFormat:@"mm"];
NSDate *currentDate2 = [NSDate date];
NSString *mins = [dateFormatter2 stringFromDate:currentDate2];
By putting a sting into an action i can get the current time:
Code:
tabb1lbl2.text=[NSString stringWithFormat:@"%@%@%@",hour,@":",mins];
Not to my problem.. this code gives me the current time, but i would like to withdraw 10 minutes from the current time. So if the time is 15:30 i would like to print out 15:20.
Is there any solution to my problem?
Sincerely,
Jim
Last edited by a moderator: