Nsdateformatter returns me day in language of the phone selected. Can it return me only English all the time?

前端 未结 3 2005
遥遥无期
遥遥无期 2021-02-04 01:45

I am using dateformatter to get days and time in the my application. But I am facing an issue when I change the language of the phone dateformatter returns me day and time of th

3条回答
  •  名媛妹妹
    2021-02-04 02:15

    Swift

    let dateFormatter = DateFormatter()
    dateFormatter.locale = NSLocale(localeIdentifier: "en_US") as Locale!
    dateFormatter.dateFormat = "dd-MM-yyyy HH:mm:ss"
    let resultsDate = dateFormatter.string(from: date)
    

提交回复
热议问题