Skip to content

mostafah/go-jalali

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

go-jalali

go-jalali provides some tools to work with Jalali Calendar in golang

There's also j2g and g2j commands to convert Jalali to Gregorian and vice versa.

Documentation

To view go doc style documentation of this project use GoDoc site here

You can also view the documentation locally once the package is installed with the godoc tool by running godoc -http=":6060" and pointing your browser to http://localhost:6060/pkg/github.com/nbjahan/go-jalali/jalali

Installation

$ go get github.com/nbjahan/go-jalali/jalali/...

Quick Start

To create time.Time from Jalali date:

var d time.Time
d = Jtog(1392, 4, 15)               // "2013-07-06"

Optionally you can specify hour, min, sec, nsec:

d = Jtog(1392, 4, 15, 17, 3, 32, 0) // "2013-07-06 17:03:32"

To convert Gregorian date to Jalali date:

year, month, day := Gtoj(time.Now())

There is also Strftime so you can convert to Jalali and format:

jstring := jalali.Strftime("Printed on %Y/%m/%d", time.Now()) // "Printed on 1392/04/02"

format flags

Checking the Leap year:

isLeap := jalali.IsLeap(time.Now())

About

jalali utils for golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages