How do I get GMT time?
NSDate *c =[NSDate date];
gives system time, not GMT.
This is a simpler version of Ramin's answer
+ (NSDate *) GMTNow
{
NSDate *sourceDate = [NSDate date];
NSTimeZone* currentTimeZone = [NSTimeZone localTimeZone];
NSInteger currentGMTOffset = [currentTimeZone secondsFromGMT];
[sourceDate addTimeInterval:currentGMTOffset];
return sourceDate;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With