1 Reply
      Latest reply on Apr 28, 2020 12:41 PM by OOPer
      jason18424 Level 1 Level 1 (0 points)

        With the date time being 1:02:27 pm and formatting using the following code,


        func getDateTimeStringFromDate() -> String {

                let formatter = DateFormatter()

                formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.000Z"

                return formatter.string(from: self)



        I was expecting the function to return the string with the "HH:mm:ss" part being 13:02:27, instead it returns 1:02:27. Notice not only it did not return the time in a 24 hour system, it also removed the leading 0 of the hour. Does anyone know what is causing this?