https://github.com/nathan-osman/go-sunrise
Go package for calculating the sunrise and sunset times for a given location
https://github.com/nathan-osman/go-sunrise
astronomy calendar golang sunrise sunset
Last synced: about 1 year ago
JSON representation
Go package for calculating the sunrise and sunset times for a given location
- Host: GitHub
- URL: https://github.com/nathan-osman/go-sunrise
- Owner: nathan-osman
- License: mit
- Created: 2017-06-15T20:49:41.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-23T10:07:48.000Z (about 2 years ago)
- Last Synced: 2024-07-31T20:50:57.564Z (almost 2 years ago)
- Topics: astronomy, calendar, golang, sunrise, sunset
- Language: Go
- Size: 59.6 KB
- Stars: 142
- Watchers: 7
- Forks: 17
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-go-with-stars - go-sunrise - 08-28 | (Date and Time / Search and Analytic Databases)
- awesome-go - go-sunrise - Calculate the sunrise and sunset times for a given location. (Date and Time / Advanced Console UIs)
- awesome-go - go-sunrise - Calculate the sunrise and sunset times for a given location. - :arrow_down:0 - :star:4 (Date and Time / Advanced Console UIs)
- awesome-go - go-sunrise - Go package for calculating the sunrise and sunset times for a given location - ★ 8 (Date and Time)
- awesome-go - go-sunrise - | - | - | (Date and Time / Advanced Console UIs)
- awesome-go-cn - go-sunrise
- awesome-go - go-sunrise - Calculate the sunrise and sunset times for a given location. (Date and Time / Advanced Console UIs)
- awesome-go - nathan-osman/go-sunrise
- fucking-awesome-go - go-sunrise - Calculate the sunrise and sunset times for a given location. (Date and Time / Search and Analytic Databases)
- awesome-go-cn - go-sunrise
- awesome-go - go-sunrise - Calculate the sunrise and sunset times for a given location. (Date and Time / Search and Analytic Databases)
- awesome-go - go-sunrise - Calculate the sunrise and sunset times for a given location. (Date and Time / Search and Analytic Databases)
- awesome-go-cn - go-sunrise - osman/go-sunrise) (日期和时间 / 检索及分析资料库)
- awesome-go - go-sunrise - Calculate the sunrise and sunset times for a given location. (Date and Time / Search and Analytic Databases)
- awesome-go-processed - go-sunrise - Calculate the sunrise and sunset times for a given location.| (Date and Time / Advanced Console UIs)
- awesome-go-extra - go-sunrise - 06-15T20:49:41Z|2021-06-07T17:58:34Z| (Date and Time / Advanced Console UIs)
- awesome-go - go-sunrise - 计算给定位置的日出和日落时间。 (<span id="日期和时间-date-and-time">日期和时间 Date and Time</span> / <span id="高级控制台用户界面-advanced-console-uis">高级控制台用户界面 Advanced Console UIs</span>)
- awesome-go - go-sunrise - Calculate the sunrise and sunset times for a given location. (Date and Time / Search and Analytic Databases)
- awesome-go-info - go-sunrise
- awesome-go - go-sunrise - Calculate the sunrise and sunset times for a given location. (Date and Time / Search and Analytic Databases)
- awesome-go-plus - go-sunrise - Calculate the sunrise and sunset times for a given location.  (Date and Time / Search and Analytic Databases)
- awesome-Char - go-sunrise - Calculate the sunrise and sunset times for a given location. (Date and Time / Advanced Console UIs)
- awesome-go-cn - go-sunrise - osman/go-sunrise) (日期和时间 / 检索及分析资料库)
- go-awesome-with-star-updatetime - go-sunrise - Calculate the sunrise and sunset times for a given location. (Date and Time / Advanced Console UIs)
README
## go-sunrise
[](https://app.travis-ci.com/nathan-osman/go-sunrise)
[](https://coveralls.io/github/nathan-osman/go-sunrise?branch=master)
[](https://goreportcard.com/report/github.com/nathan-osman/go-sunrise)
[](https://godoc.org/github.com/nathan-osman/go-sunrise)
[](http://opensource.org/licenses/MIT)
Go package for calculating the sunrise and sunset times for a given location based on [this method](https://en.wikipedia.org/wiki/Sunrise_equation#Complete_calculation_on_Earth).
### Usage
To calculate sunrise and sunset times, you will need the following information:
- the date for which you wish to calculate the times
- the latitude and longitudinal coordinates of the location
Begin by importing the package:
import "github.com/nathan-osman/go-sunrise"
Next, feed the information into the SunriseSunset() method:
rise, set := sunrise.SunriseSunset(
43.65, -79.38, // Toronto, CA
2000, time.January, 1, // 2000-01-01
)
The two return values will be the sunrise and sunset times for the location on the given day as time.Time values. If sun does not rise or set, both return values will be time.Time{}.