How to convert UTC date string to local time (systemTimeZone)

Viewed 19394

Input String: June 14, 2012 - 01:00:00 UTC

Output Local String: Jun 13, 2012 - 21:00:00 EDT

I like to get the offset from

NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone];
NSLog(@"Time Zone: %@", destinationTimeZone.abbreviation);

Any suggestion ?

5 Answers
func timeConverter() -> 
{
    let zone = TimeZone.current
    let sec = -TimeInterval(zone.secondsFromGMT(for: self)
    return Date(timeInterval: sec , since : self)
}
Related