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

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 and want to learn more, check out The Complete iOS Developer Bootcamp. Speed up your learning curve - hundreds of students have already joined. Thanks for reading!

Eddy Chung

I teach iOS development on ZeroToAppStore.com.

Similar Posts