juliandays

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: MIT Imports: 3 Imported by: 2

README

Go-JulianDays

Go Report Card Go Reference

Go-JulianDays is a simple package for converting date time into Julian Days and vice versa.

Usage Examples

package main

import (
	"fmt"
	"time"

	"github.com/hablullah/go-juliandays"
)

func main() {
	// Convert date time to Julian Days
	dt := time.Date(2021, 1, 1, 12, 0, 0, 0, time.UTC)
	jd, _ := juliandays.FromTime(dt)
	fmt.Printf("%s = %.0f JD\n", dt.Format("2006-01-02 15:04:05"), jd)

	// Convert Julian Days to date time
	jd = 100
	dt = juliandays.ToTime(jd)
	fmt.Printf("%.0f JD = %s\n", jd, dt.Format("2006-01-02 15:04:05"))
}

Codes above will give us following results :

2021-01-01 12:00:00 = 2459216 JD
100 JD = -4712-04-10 12:00:00

Resources

  1. Anugraha, R. 2012. Mekanika Benda Langit. (PDF)

License

Go-JulianDays is distributed using MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromTime

func FromTime(dt time.Time) (float64, error)

FromTime converts Golang std time into Julian Days.

func ToTime

func ToTime(jd float64) time.Time

ToTime converts Julian Days into Golang std time.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL