To convert GMT to Australian Eastern Standard Time in Swift, you need to:
DateFormatter object and set it to the GMT timezone.timeZone property of the DateFormatter object to the Australian Eastern Standard Time timezone.date(from:) method of the DateFormatter object to convert the GMT date string to an NSDate object.string(from:) method of the DateFormatter object to convert the NSDate object to an Australian Eastern Standard Time date string.Here's an example code snippet:
main.swift433 chars12 linesIn this example, we're converting the GMT date string "2021-09-01 12:00:00 GMT" to Australian Eastern Standard Time. The output will be "2021-09-01 22:00:00", which is 10 hours ahead of GMT.
gistlibby LogSnag