0

I have a string like 2009-10-09 08:39:20 +0000 and want to covert into an exact date format. Can anyone help me?

The date format is "yyyy-MM-dd HH:mm:ss +0000" (I don't know the meaning of +0000)

wonea
  • 4,783
  • 17
  • 86
  • 139
SmarterSusheel
  • 169
  • 2
  • 15
  • This is not duplicate question my main thing is how i convert this date to perfectly this formate like "yyyy-MM-dd HH:mm:ss +0000" (i dont know the exactly meaning of +0000) – SmarterSusheel Mar 01 '16 at 07:27

1 Answers1

5

Use NSDateFormatter like this

NSDateFormatter* df = [[NSDateFormatter alloc] init];
df.calendar = [NSCalendar currentCalendar];
df.dateStyle = NSDateFormatterMediumStyle;
[df setDateFormat:@"yyyy-MM-dd HH:mm:ss ZZZ"];
NSDate* tDate = [df dateFromString:@"2009-10-09 08:39:20 +0000"];
Jecky
  • 476
  • 1
  • 4
  • 21
Ali Riahipour
  • 524
  • 6
  • 20