how to calculate Mid night time intervals in iphone development?
i am working on stock market app, and i need to calculate a timeinterval after market closed.
suppose stock market is closed at 6:30 pm after that i need to time interval till 12:00
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, You really should provide more info about your input data.
Because if you have two NSDate values containing full date and time info you need nothing more than timeIntervalSinceDate:
You’ll get 63000 s = 17.5 h
But it looks like you have times without date information. In this case you’ll get wrong negative value:
result is -23400 s = -6.5 h
So in this case you should correct the result, because you know second date is after midnight: