Is it possible to convert a var with the day of the week to a number? (and the other way around)
let diaSetmana = "Monday" let diaSetmana2 = 2
I know how to convert from date(): let date = Date() let calendar = Calendar.current let dateFormatter = DateFormatter() dateFormatter.dateFormat = "EEEE" let dayString = dateFormatter.string(from: date)
I am asking for converting not from date() but from a var that I have a random day of the week