To convert Chatham time to GMT in Swift, you need to use the DateFormatter and TimeZone classes.
First, you need to create two TimeZone objects, one for Chatham Time and the other for GMT.
main.swift110 chars3 linesNext, create an instance of DateFormatter and set the time zone to Chatham Time.
main.swift126 chars4 linesNow you can convert a Chatham Time String to Date:
main.swift109 chars3 linesFinally, set the time zone of the Date object to GMT and format it as a String.
main.swift149 chars4 linesThe resulting String will be the equivalent time in GMT.
gistlibby LogSnag