Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSDate formatter

I try to convert a string to NSDATE with no luck unfortunately.

Friday, October 22, 11:26:45 ET 2010

I know the options for formatting (http://sree.cc/objective-c/nsdate-format-string-in-objective-c) but i cant get it to work.

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"???????"];

anyone?

like image 444
Oritm Avatar asked Sep 21 '26 06:09

Oritm


1 Answers

Date Format Specifiers.

So you'd probably need something like:

[dateFormatter setDateFormat:@"eeee, MMMM dd, HH:mm:ss z yyyy"];
  • eeee - Local day of week spelled out
  • MMMM - Month spelled out
  • dd - day of month with no leading zeros
  • HH - hour of day (24 hour format)
  • mm - minutes of hour (with leading zero)
  • ss - seconds of minute (with leading zero)
  • z - timezone (short wall time)
  • yyyy - calendar year
like image 174
Dave DeLong Avatar answered Sep 23 '26 21:09

Dave DeLong



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!