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.

Weather service not working anymore?
#56
(25.03.2019, 07:34)admin Wrote: Apixu free tier does not provide astronomy data. Moon phase calculation is relatively simple. Here's a formula that gives number of days since new moon cycle:
Code:
local date = os.date('*t')
local y, m, d = date.year, date.month, date.day

if m < 3 then
 y = y - 1
 m = m + 12
end

local a = math.floor(y / 100)
local b = math.floor(a / 4)
local c = 2 - a + b
local e = math.floor(365.25 * (y + 4716))
local f = math.floor(30.6001 * (m + 1))
local jd = c + d + e + f - 1524.5  

local dn = jd - 2451549.5
local nm = dn / 29.53
local dc = (nm % 1) * 29.53

log(dc)

Thanks Admin,

Is there a way to get what phase the moon is in right now?

BR Even Sundgot.
Reply


Messages In This Thread
RE: Weather service not working anymore? - by Evens - 26.03.2019, 17:21

Forum Jump: