i have a date converted to double value and saved in database.now i want to compare if cureentdate > myDataBaseDate+8 hours. means i want to get 8 hours more added in my database date. i'm converting date into double values.so how do i get 8 hours later time from my database saved date. how do i compare if(currentDateTime>DateFromdatabaseValue+DateByAdding8HoursInDataBase)
A:
You can simply add 8 * 3600 to your database value (assuming that your converted double value represents seconds).
Pascal
2009-10-31 13:48:51
+6
A:
I'm not entirely sure what you are trying to do, but you can create an NSDate object by adding time in seconds on to another NSDate using:
- (id)dateByAddingTimeInterval:(NSTimeInterval)seconds
eg. to add 8 hours:
NSDate *mydate = [NSDate date];
NSTimeInterval secondsInEightHours = 8 * 60 * 60;
NSDate dateEightHoursAhead = [mydate dateByAddingTimeInterval:secondsInEightHours];
Tom
2009-10-31 13:51:26
Thanks a lot. I needed to know that two :)
rdesign
2010-01-15 11:56:14
A:
dateByAddingTimeInterval method does not exist. you need to use [mydate addTimeInterval:secondsInEightHours];
Vijay Shankar
2010-03-25 14:37:34