I'm trying to create a date in ios with:
NSCalendar *gregorian=[[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar];
[gregorian setTimeZone:[NSTimeZone systemTimeZone]];
NSDateComponents *dateComponentes=[[NSDateComponents alloc] init];
//We create a date invented.
[dateComponentes setYear:2014];
[dateComponentes setMonth:2];
[dateComponentes setDay:15];
[dateComponentes setHour:0];
[dateComponentes setMinute:0];
[dateComponentes setSecond:0];
[dateComponentes setTimeZone:[NSTimeZone systemTimeZone]];
NSDate *initialDate = [gregorian dateFromComponents:dateComponentes];
The thing is, my current time zone is BST, but when I print the time I get this:
(lldb) po [initialDate descriptionWithLocale:[NSLocale localeWithLocaleIdentifier:@"en_GB"]]
Saturday, 15 February 2014 00:00:00 Greenwich Mean Time
But should I get the 2014-02-14 23:00:00 +0000 for this date? :
(lldb) po [initialDate description]
2014-02-15 00:00:00 +0000
I tried with NSDate and is right,
(lldb) po [[NSDate date] descriptionWithLocale:[NSLocale localeWithLocaleIdentifier:@"en_GB"]]
Thursday, 29 May 2014 16:35:21 British Summer Time
(lldb) po [[NSDate date] description]
2014-05-29 15:35:26 +0000
Any ideas?