The module SunTimesMBS

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

The module SunTimesMBS

module SunTimesMBS
Type Topic Plugin Version macOS Windows Linux iOS Targets
module Math MBS Util Plugin 12.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
A helper module to calculate sunset/sunrise times.
Example
// may be an hour off due to daylight saving time

dim d as new date

dim jd as Double = SunTimesMBS.CalcJulianDate(d.day, d.Month, d.Year)

// Koblenz, Germany
const latitude = 50.356667
const longitude = 7.593889

// Miami, FL
'const latitude = 25.787778
'const longitude = -80.224167

dim sr as Double = SunTimesMBS.CalcSunriseUTC(jd, latitude, longitude)
dim ss as Double = SunTimesMBS.CalcSunsetUTC (jd, latitude, longitude)

d.gmtoffset = 0
d.hour = 0
d.minute = 0
d.second = 0

dim base as Double = d.totalseconds
d.totalseconds = sr*60 + base

MsgBox "Sunrise: "+d.longdate+" "+d.longtime

d.totalseconds = ss*60 + base

MsgBox "Sunset: "+d.longdate+" "+d.longtime

The example code above works well, but seems not to take into account the daylight saving time.

Blog Entries


The items on this page are in the following plugins: MBS Util Plugin.


💬 Ask a question or report a problem