jdn

package module
Version: v0.0.0-...-6f88db6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 1 Imported by: 2

README

jdn

Julian Day Numbers for Go

Installation

To install run:

go get github.com/leemcloughlin/jdn

Documentation

For documentation including examples please see:

https://pkg.go.dev/github.com/leemcloughlin/jdn

Documentation

Overview

Convert to and from Julian Day Numbers

Note uses only integer arithmetic

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromNumber

func FromNumber(julianDay int) (year int, month time.Month, day int)

FromNumber converts a Julian Day Number to a year, month, day in the appropriate calendar (Julian or Gregorian).

Example
y, m, d := FromNumber(2456157) // Day I met my fiancé
fmt.Printf("%d %s %d\n", y, m, d)
Output:

2012 August 17

func ToNumber

func ToNumber(year int, month time.Month, day int) (julianDay int)

ToNumber converts a year, month, day into a Julian Day Number. Based on http://en.wikipedia.org/wiki/Julian_day#Calculation. Only valid for dates after the Julian Day epoch which is January 1, 4713 BCE.

Example
jd := ToNumber(2012, time.August, 17) // Day I met my fiancé
fmt.Println(jd)
Output:

2456157

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL