Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.mac.programmer.help > #4

Re: NSDateFormatter help

From Jim <jim@magrathea.plus.com>
Newsgroups comp.sys.mac.programmer.help
Subject Re: NSDateFormatter help
Date 2011-03-09 16:48 +0000
Message-ID <slrninfbqo.2ki5.jim@wotan.magrathea.local> (permalink)
References <slrninevb7.2c09.jim@wotan.magrathea.local> <tph-AF5BA6.09413509032011@localhost>

Show all headers | View raw


On 2011-03-09, Tom Harrington <tph@pcisys.no.spam.dammit.net> 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.

I think you're right about it being the 'UT' bit - I suspect that if I
change it to GMT it'll be fine.

Jim
-- 
Twitter:@GreyAreaUK       Facetime ID:jim@magrathea.plus.com

"[Angry Birds is] marginally more addictive than a compound of crack cocaine,
 strong tobacco and powdered orgasms." - The Daily Mash

Back to comp.sys.mac.programmer.help | Previous | NextPrevious in thread | Find similar


Thread

NSDateFormatter help Jim <jim@magrathea.plus.com> - 2011-03-09 13:15 +0000
  Re: NSDateFormatter help Tom Harrington <tph@pcisys.no.spam.dammit.net> - 2011-03-09 09:41 -0700
    Re: NSDateFormatter help Jim <jim@magrathea.plus.com> - 2011-03-09 16:48 +0000

csiph-web