NSDate in iOS

Mr.Javed Multani
1 min readOct 3, 2020

There are different types of date format that you can set: Here is full list of them.

There are many more, for getting different time based on zone(z), for getting time with millisecond details(S), etc.


Creating an NSDateFormatter instance is an expensive operation, so it is recommended to create it once and reuse when possible.

Useful extension for converting date to string.

extension Date {
func toString() -> String {let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MMMM dd yyyy"
return dateFormatter.string(from: self)
Mr.Javed Multani

Software Engineer | Certified ScrumMaster® (CSM) | UX Researcher | Youtuber | Tech Writer