#timestamp #dateformatter #dateHumanRead
// Get timestamp
let date = Date().timeIntervalSince1970
let dateFormatter = DateFormatter()
let timezone = TimeZone.current.localizedName(for: .shortStandard, locale: .current) ?? ""
dateFormatter.timeZone = TimeZone(abbreviation: timezone)
dateFormatter.locale = NSLocale.current
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
let strDate = dateFormatter.string(for: Date(timeIntervalSince1970: date))
// prepare advertisement data
let data: Data = strDate!.data(using: String.Encoding.utf8)!