Answers for "how to change date format in swift"

1

date formatter swift

func getTimeStampDateString() -> String {
        let date = Date(timeIntervalSinceNow: self.doubleValue)
        let dateFormatter = DateFormatter()
        dateFormatter.timeZone = TimeZone(abbreviation: "GMT")
        dateFormatter.locale = NSLocale.current
        dateFormatter.dateFormat = "d MMM HH:mm:ss"
        let strDate = dateFormatter.string(from: date)
        return strDate
    }
Posted by: Guest on May-05-2021
2

How to create a Swift Date object

let currentDateTime = Date()
Posted by: Guest on March-20-2020

Code answers related to "how to change date format in swift"

Code answers related to "Swift"

Browse Popular Code Answers by Language