I need to change a NSDate object. What I am basically doing is changing the year value.
for example:
NSString *someYear = @"2093";
NSDate *date = [NSDate date]; // Gets the current date.
... Create a new date based upon 'date' but with specified year value.
So with 'date' returning 2011-03-06 22:17:50 +0000 from init, I would like to create a date with 2093-03-06 22:17:50 +0000.
However I would like this to be as culturally neutral as possible, so it will work whatever the timezone.
Thanks.
Take a look at NSCalendar
, especially components:fromDate:
and dateFromComponents:
methods.