Help us shape the future of Go! Take the 2026 Go Developer Survey

hijri

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2019 License: MIT Imports: 3 Imported by: 0

README

Go-Hijri

GoDoc

Go-Hijri is a Go package for converting Gregorian date to Hijrian date, and vice-versa.

Usage Examples

package main

import (
	"fmt"
	"time"

	"github.com/RadhiFadlillah/go-hijri"
)

func main() {
	// 1 January 2019 to Hijri
	src := time.Date(2019, 1, 1, 0, 0, 0, 0, time.Local)
	y, m, d := hijri.ToHijri(src)
	fmt.Printf("%s AD = %04d-%02d-%02d H\n", src.Format("2006-01-02"), y, m, d)

	// 1 Ramadhan 1440 to Gregorian
	ramadhan := hijri.ToGregorian(1440, 9, 1)
	fmt.Printf("1440-09-01 H = %s AD\n", ramadhan.Format("2006-01-02"))
}

Codes above will give us following results :

2019-01-01 AD = 1440-04-23 H
1440-09-01 H = 2019-05-06 AD

Resource

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

License

Go-Hijri is distributed using MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToGregorian

func ToGregorian(year, month, day int) time.Time

ToGregorian converts Hijri date to Gregorian date.

func ToHijri

func ToHijri(date time.Time) (int, int, int)

ToHijri converts Gregorian date to Hijri.

Types

This section is empty.

Jump to

Keyboard shortcuts

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