Documentation
¶
Overview ¶
Package gengou implements functions for converting dates to the Japanese era calendar scheme.
Index ¶
Examples ¶
Constants ¶
View Source
const Offset = 9 * 60 * 60
View Source
const Version = "0.1.0"
Variables ¶
View Source
var Eras = []Era{}/* 243 elements not displayed */
All Japanese eras, from 大化 to 令和.
Functions ¶
func EraDate ¶ added in v0.0.2
EraDate returns the full era name and date corresponding to t
Example ¶
package main
import (
"blekksprut.net/gengou"
"fmt"
"time"
)
var layout = "2006.01.02 MST"
func main() {
date, _ := time.Parse(layout, "1991.07.29 JST")
fmt.Println(gengou.EraDate(date))
}
Output: 平成3年7月29日
func EraDateWithZeros ¶ added in v0.0.9
EraDateWithZeros returns the era year and zero-prefixed month and day for t
Types ¶
type Era ¶
Represents a Japanese era.
func Find ¶
Find returns the Era matching time t. Reports an error if the date is before the first era (大化).
Example ¶
package main
import (
"blekksprut.net/gengou"
"fmt"
"time"
)
func main() {
now := time.Now()
era, err := gengou.Find(now)
if err != nil {
panic(err)
}
fmt.Println(era.Name)
}
Output: 令和
Click to show internal directories.
Click to hide internal directories.
