0

I have a problem, i want make a date for local notify from a string. I make this:

NSDateFormatter *dateForm = [[NSDateFormatter alloc] init];
[dateForm setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *dateSelected = [dateForm dateFromString:@"2012-09-01 08:00:00"];
NSLog(@"notify time: |%@| \n", dateSelected);

but the log is:
notify time: |2012-09-01 06:00:00 +0000|
the time is wrong! Why? tanks for help!
I use iOS 5.1 and xcode 4.4

Doom
  • 1,258
  • 3
  • 15
  • 24

1 Answers1

0

Try adding

[dateForm setTimeZone:[NSTimeZone defaultTimeZone]];

or

[dateForm setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]];

And replace GMT with your timezone.

Bot
  • 11,868
  • 11
  • 75
  • 131