This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

sunrise and sunset values
#18
Code:
latitude = 11.11
longitude = 22.22
sunrise, sunset = rscalc(latitude, longitude)

date = os.date('*t')
now = date.hour * 60 + date.min

-- from 0:00 to sunrise
if now < sunrise then
  alert('before sunrise')
-- from sunset to 23:59
elseif now > sunset then
  alert('after sunset')
else
  alert('day')
end
Reply


Messages In This Thread
sunrise and sunset values - by Thomas - 22.09.2017, 09:46
RE: sunrise and sunset values - by admin - 22.09.2017, 10:24
RE: sunrise and sunset values - by buuuudzik - 25.02.2018, 08:42
RE: sunrise and sunset values - by FatMax - 14.12.2018, 09:37
RE: sunrise and sunset values - by Thomas - 25.09.2017, 09:48
RE: sunrise and sunset values - by admin - 25.09.2017, 10:22
RE: sunrise and sunset values - by Thomas - 04.10.2017, 15:41
RE: sunrise and sunset values - by admin - 25.02.2018, 10:49
RE: sunrise and sunset values - by buuuudzik - 25.02.2018, 11:36
RE: sunrise and sunset values - by admin - 26.02.2018, 07:57
RE: sunrise and sunset values - by buuuudzik - 26.02.2018, 09:20
RE: sunrise and sunset values - by admin - 26.02.2018, 10:26
RE: sunrise and sunset values - by buuuudzik - 26.02.2018, 14:31
RE: sunrise and sunset values - by admin - 27.02.2018, 09:55
RE: sunrise and sunset values - by buuuudzik - 27.02.2018, 11:21
RE: sunrise and sunset values - by admin - 27.02.2018, 11:34
RE: sunrise and sunset values - by buuuudzik - 27.02.2018, 12:17
RE: sunrise and sunset values - by Mrinj - 18.03.2018, 21:52
RE: sunrise and sunset values - by admin - 19.03.2018, 07:08
RE: sunrise and sunset values - by Mrinj - 19.03.2018, 08:30
RE: sunrise and sunset values - by admin - 14.12.2018, 09:41
RE: sunrise and sunset values - by FatMax - 14.12.2018, 10:11
RE: sunrise and sunset values - by YOUSSEF - 29.09.2021, 07:50
RE: sunrise and sunset values - by admin - 29.09.2021, 08:18
RE: sunrise and sunset values - by Dan22 - 22.12.2021, 13:04
RE: sunrise and sunset values - by admin - 22.12.2021, 13:17
RE: sunrise and sunset values - by Dan22 - 22.12.2021, 14:04
RE: sunrise and sunset values - by Dan22 - 25.12.2021, 23:07
RE: sunrise and sunset values - by admin - 27.12.2021, 09:38
RE: sunrise and sunset values - by Dan22 - 28.12.2021, 15:51
RE: sunrise and sunset values - by Daniel - 28.12.2021, 16:06
RE: sunrise and sunset values - by Dan22 - 29.12.2021, 07:32
RE: sunrise and sunset values - by Daniel - 29.12.2021, 10:28
RE: sunrise and sunset values - by Dan22 - 30.12.2021, 10:52
RE: sunrise and sunset values - by Daniel - 30.12.2021, 11:10
RE: sunrise and sunset values - by Dré - 30.10.2022, 16:11
RE: sunrise and sunset values - by admin - 31.10.2022, 06:45
RE: sunrise and sunset values - by Dré - 31.10.2022, 19:21

Forum Jump: