let dateformatter = DateFormatter() dateformatter.dateFormat = "aaa" if dateformatter.string(from: Date()) == dateformatter.amSymbol { view.backgroundColor = UIColor.white } else { view.backgroundColor = UIColor.black }