Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compare two NSDates

How can I compare two NSDates and return the amount of time between them.

For example:

2010-06-20 14:29:41 -0400
2010-06-20 14:53:29 -0400

should return something like: 23 or 24(minutes), rounding the seconds because I don't really need the seconds.

like image 602
Matt S. Avatar asked Jun 20 '10 18:06

Matt S.


1 Answers

try something like:

int intervall = (int) [date1 timeIntervalSinceDate: date2] / 60;
like image 144
phonecoddy Avatar answered Oct 25 '22 01:10

phonecoddy