14.12.2018, 09:37
(22.09.2017, 10:24)admin Wrote: You can use rscalc function from common functions to get sunrise and sunset time in minutes. Then you can convert it to text (or use a day/time object instead):
Code:latitude = 11.11
longitude = 22.22
sunrise, sunset = rscalc(latitude, longitude)
sunrise_hour = math.floor(sunrise / 60)
sunrise_minute = sunrise % 60
sunset_hour = math.floor(sunset / 60)
sunset_minute = sunset % 60
sunrise_text = string.format('%02d:%02d', sunrise_hour, sunrise_minute)
sunset_text = string.format('%02d:%02d', sunset_hour, sunset_minute)
Is it possible to get unix time when using rscalc? I'm using the values from the settings (lat, long), but getting 600 as result from sunrise = rascals(latitude).