Re: Best way to parse a time today?

2011-10-13 Thread Rick Mann
I think the concern is this. Say today is the day that a time change occurs. In the US, this happens at 2 am. When you move the clocks forward, the instant the clock would roll from 1:59:59.999 to 2:00:00.000, it actually rolls to 3:00:00.000. All of the times in the half-open interval (2:00,

Best way to parse a time today?

2011-10-12 Thread Rick Mann
I have a situation where I have to parse times like 14:50 PDT. If I just set up an NSDateFormatter with dateFormat = @HH:mm z, I end up with a time of day in 1970. What's the best way to get it to give me that time of day today? Thanks, Rick ___

Re: Best way to parse a time today?

2011-10-12 Thread Roger Dalal
Rick: The following code, which is likely what you are doing, will return the time in 1970 (NSDate's reference date) because you have not specified a date: NSString *timeString = @14:50 PDT; NSDateFormatter *df = [[NSDateFormatter alloc ] init]; [df setDateFormat:@HH':'mm zzz]; NSDate *date =

Re: Best way to parse a time today?

2011-10-12 Thread Dave DeLong
Be careful with this approach, since there are some weird edge cases where that time may not exist on the proposed day (think DST boundaries). Dave Sent from my iPhone On Oct 12, 2011, at 6:46 PM, Roger Dalal roger.da...@gmail.com wrote: Rick: The following code, which is likely what you

Re: Best way to parse a time today?

2011-10-12 Thread Roger Dalal
Dave: Would it be possible for you to present an improved approach, please? I use this solution frequently, and have not yet encountered any issues, but now you have me worried! What approach do you suggest? Roger Dalal On Oct 12, 2011, at 9:49 PM, Dave DeLong wrote: Be careful with this