Re: Getting the GMT time
Re: Getting the GMT time
- Subject: Re: Getting the GMT time
- From: Brian Bergstrand <email@hidden>
- Date: Fri, 16 Apr 2004 15:53:09 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Here's an inline I use to get the GMT time.
static __inline NSCalendarDate* GMTDate(NSDate *d)
{
return ([d dateWithCalendarFormat:nil timeZone:[NSTimeZone
timeZoneWithAbbreviation:@"GMT"]]);
}
To get the current time, use the following:
id gmt;
gmt = GMTDate([NSDate date]);
HTH.
On Apr 16, 2004, at 3:11 PM, Frederick C. Lee wrote:
>
Greetings:
>
>
Is there a simple way to get the GMT time?
>
>
The only viable way I know is to get the time offset from the local
>
time zone and compute it.
>
>
But is there a direct way to actually get the GMT?
>
>
The following snippet I've tried but I get a nil result:
>
>
NSTimeZone *t = [[NSTimeZone alloc] init];
>
>
if ([t initWithName:@"GMT"] == nil) {
>
NSLog(@"***** NULL Time zone???");
>
}
>
>
NSCalendarDate *GMTtime = [NSCalendarDate calendarDate];
>
[GMTtime setTimeZone:t];
>
>
>
>
I'm lost here.
>
>
Regards,
>
>
Ric.
>
Brian Bergstrand <
http://www.bergstrand.org/brian/>, AIM: triryche206
PGP Key: <
http://www.bergstrand.org/brian/misc/public_key.txt>
The word 'politics' is derived from the word 'poly', meaning 'many',
and the word 'ticks', meaning 'blood sucking parasites'. - Larry
Hardiman
As of 03:50:04 PM, iTunes is playing "Losing Myself" from "Tribe" by
"Queensrche"
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3
iQA/AwUBQIA5tXnR2Fu2x7aiEQJyFgCfcKmr+4i8uwDMATDzQi0o9WcZPokAnj92
xdXxB6f64I0yY30pNjHrDP3N
=VpU2
-----END PGP SIGNATURE-----
_______________________________________________
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.