Path: csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.glorb.com!news2.glorb.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.pcisys.net!news.pcisys.net.POSTED!not-for-mail NNTP-Posting-Date: Wed, 09 Mar 2011 10:41:36 -0600 From: Tom Harrington Newsgroups: comp.sys.mac.programmer.help Subject: Re: NSDateFormatter help Organization: Atomic Bird References: User-Agent: MT-NewsWatcher/3.5.1 (Intel Mac OS X) Date: Wed, 09 Mar 2011 09:41:35 -0700 Message-ID: Lines: 25 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-BW1/qu4qLchs8WsQtUZWB6SpB9P4oGfM7PZDlFAvvNepX3AWIjoujtmwEnre6i0GSh+o2xK4awOEoox!9s4uHUA8lsfBnRZyWg4BINgPNHwhBnRqBdLioFQFNAsdIhC4AYi09lsfonSLMV69bk35f2i0U4XG!SK4rng== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1782 Xref: x330-a1.tempe.blueboxinc.net comp.sys.mac.programmer.help:3 In article , Jim wrote: > I've got an NSString that contains a date/time. An actual example of > this is: > > 1230 UT 09 Mar 2011 > > > I'm trying to get this into an NSDate object, and I *thought* that the > formatter should be: "HHmm z dd MMM yyyy" but this always returns a bad > date. I've tried various z's (up to four) and I've tried using a few > other things but something isn't right. > > What *should* the formatter be? I suspect it's failing on the time zone. I suggest trying "v" for that instead of "z", which looks more likely to match. Or, if all of the times are UTC, you could include a literal "UT" in the format string and then treat the result as UTC. -- Tom "Tom" Harrington Independent Mac OS X developer since 2002 http://www.atomicbird.com/