You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can just use a Date extension to accomplish this.
extension Date
var time: String{
let formatter = DateFormatter()
formatter.dateFormat = "H:mm" //Whatever time format you want
return formatter.string(from: self)
}
}
Then when you use Solar, just convert it like this:
let solar = Solar(coordinate: CLLocationCoordinate2D(latitude: latitude, longitude: longitude))
let sunrise = solar?.sunrise
let sunset = solar?.sunset
print("Sunrise: \(sunrise?.time)")
print("Sunset: \(sunset?.time)")
Is it possible to return only the hours and minutes of the sunset or sunrise?
The text was updated successfully, but these errors were encountered: