4

I want to get current date and time zone of user in Swift 3. I tried in Swift 2.2 following code :

static var localTimeZoneAbbreviation: String { return NSTimeZone.localTimeZone().abbreviation!}
Nirav D
  • 71,513
  • 12
  • 161
  • 183
Mohsin Qureshi
  • 1,203
  • 2
  • 16
  • 26

1 Answers1

11

For getting abbreviation from NSTimeZone.

static var localTimeZoneAbbreviation: String { return  NSTimeZone.local.abbreviation(for: Date())! }

For getting current Date.

let currentDate = Date()
Nirav D
  • 71,513
  • 12
  • 161
  • 183