How to turn a Date to Seconds on Swift?

Asked

Viewed 33 times

0

How can I transform the Date for seconds? The code I’m trying to implement is this:

let dataAtual = Date()

var calendar = Calendar.current
        
if let timeZone = TimeZone(identifier: "BRT") {
    calendar.timeZone = timeZone
}
  • 1

    Seconds since when? Since an arbitrary date, an "epoch", or would the number of seconds of the current day? I use the Date.timeIntervalSince1970 property when I need the Unix-style Timestamp number of seconds.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.