Re: NSDate and Date formatters
Re: NSDate and Date formatters
- Subject: Re: NSDate and Date formatters
- From: Adrian Bool <email@hidden>
- Date: Thu, 15 Jan 2004 14:18:50 +0100
On 15 Jan 2004, at 01:34, Louis C. Sacha wrote:
NSCalendarDate has a method -(void)setTimeZone:(NSTimeZone *)zone,
which you should be able to use to set the time zone of the
NSCalendarDate to GMT. I haven't tested it, but the following should
work the way you want:
/* typed in mail, etc... */
NSCalendarDate *elapsedTime = [NSCalendarDate
dateWithTimeIntervalSinceReferenceDate: seconds];
[elapsedTime setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
[timeRemainingTextField setObjectValue:elapsedTime] ;
It might be a bit more efficient to store the NSTimeZone instance as
an instance variable instead of making a new autoreleased one each
time, since you are likely updating the counter every second...
Hi Luis,
Thanks for the suggestion. In the end, seeing that I did not really
want to display a date as such - just a time, I created my own very
small TimeFormatter class - which just takes an integer in an NSNumber
object and displays it in the format I desire... No time zone problems
to worry about at all!
Cheers,
aid
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.