iphone - How to tell amount of hours since NSDate -
I started an NSDate [date of NSDT]; And I want to check that it has been 5 hours since the NSDT variable. How will i do it? What do I have in my code
requestTime = [[NSDT Alok] init]; Request time = [NSDT Date];
Later in one of the rules, I want to check whether the request has been 12 hours since the time of its time or not. Please help! thank you in advanced.
int seconds = - (int) [request timeInternewelseon]; Int hours = seconds / 3600;
Basically here I am asking how many seconds have passed since we have received our request time earlier. Then with the magic of a little mathematics, the number of seconds in one hour, alias, how many hours can we reach.
One word of caution, make sure that you use the "retention" keyword while setting the request time. Likes to forget the encoder how NSDT objects are set without it.
requestTime = [[Maintaining the date of NSDT]];
Comments
Post a Comment