How To Set Date String AM/PM To Lowercase In Swift

By Eddy Chung

By default, AM and PM are in upper case font when you use the DateFormatter

How To Set Date String AM/PM To Lowercase In Swift

After using your DateFormatter, simply call lowercased() on your date string.

let date = Date()
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "ha"
let formattedDate = dateFormatter.string(from: date).lowercased()
If you liked this post, you'll love my free guide: Secrets To iOS Development. Speed up your learning curve - hundreds of students have already downloaded. Thanks for reading!
Profile Picture of Eddy Chung

Eddy Chung

I am a professional iOS developer in Silicon Valley. I teach iOS development on ZeroToAppStore.com. If you'd like to learn more about me click here or you can contact me at: eddy@zerotoappstore.com

Similar Posts