ios - dateFromString returning nil for 12 hour format irrespective of setting locale to "en_US_POSIX" -
trying date string in particular date format dateformatter.datefrom(string) returning nil. device has 12 hour format. works when changed 24 hour format.i have set locale en_us_posix still not working.can please me issue.
you can try following code:
let dateformatter1 = dateformatter() dateformatter1.locale = nslocale(localeidentifier: "en_us") locale dateformatter1.datestyle = .none dateformatter1.timestyle = .short timefromtext.text = dateformatter1.string(from: fromtimepicker.date)
Comments
Post a Comment