How can I convert an NSDate to seconds? I need it in seconds so that I can added 30 secs to the date and then convert back to NSDate to schedule a local notification. Any better ways of doing that are welcome too.
You can use dateByAddingTimeInterval and pass in the value as 30. This will return you an NSDate which will be 30 secs ahead.
NSDate *newDate = [previousDate dateByAddingTimeInterval:30];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With