Two time periods, judging the difference between, do some time range limit use
NSDateFormatter * Dateformatter = [[NSDateFormatter alloc] init];
[Dateformatter setdateformat:@ "YYYYMMDDHHMMSS"];
nsdate* toDate = [dateformatter datefromstring:@ "20140702142033"];
nsdate* startdate = [[NSDate alloc] init];
nscalendar* Chineseclendar = [[Nscalendar alloc] Initwithcalendaridentifier:nsgregoriancalendar];
Nsuinteger unitflags = Nshourcalendarunit | Nsminutecalendarunit | Nssecondcalendarunit | Nsdaycalendarunit | Nsmonthcalendarunit | Nsyearcalendarunit;
Nsdatecomponents *cps = [Chineseclendar components:unitflags fromdate:startdate todate:todate options:0];
Nsinteger diffyear = [cps year];
Nsinteger Diffmon = [cps month];
Nsinteger diffday = [cps day];
Nsinteger diffhour = [cps hour];
Nsinteger diffmin = [cps minute];
Nsinteger diffsec = [cps second];
NSLog (@ "from-now-%@, Diff:years:%d Months:%d, days;%d, Hours:%d, mins:%d, sec:%d", [toDate description], Diffyea R, Diffmon, Diffday, Diffhour, diffmin,diffsec);