Just out of curiosity (since this was the first time I had to figure it out in Cocoa) -Is this the best way to calculate this year?
int thisYear = [[[NSCalendar currentCalendar] components:NSYearCalendarUnit fromDate:[NSDate date]] year];
Seems pretty awkward ..
Yes, when I need to get components from a date, such as a day, month or year, I use NSDateComponents , the fact is dates are awkward. - There are different calendars, time zones, leap years, etc.
NSDateComponents
Source: https://habr.com/ru/post/1440367/More articles:Why sosex! Does dlk work forever in windows 7? - windbgReplacing @selector with direct code - iosMake OR with ransack - ruby-on-railsCannot start SWT application in Eclipse - javaDetecting an application coming from the background and requesting a PIN on Android - androidwhy nested control statements on one line do not work in python? - pythonREST API and security - jsonConfirmation element color in Selenium IDE - htmlImplement security in REST? - securityIs it possible to run javascript code based on template variables in Tornado? - pythonAll Articles