sumeragi

package module
v0.0.0-...-38d29a2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2015 License: MIT Imports: 1 Imported by: 0

README

sumeragi GoDoc

##Example

func main() {
    now := sumeragi.Now()
    r, k := sumeragi.Era(now)
    fmt.Printf("Now: %v, %s (%s)\n", now, r, k)

    utc := time.Date(987, time.January, 1, 0, 0, 0, 0, time.UTC)
    koki := sumeragi.To(utc)
    r, k = sumeragi.Era(utc) // Any time zones are acceptable for Era
    fmt.Printf("UTC: %v\nKoki: %v, %s (%s)\n", utc, koki, r, k)
}

Prints something like:

Now: 2675-10-31 08:22:19.577885806 +0900 SUMERAGI, Heisei (平成)
UTC: 0987-01-01 00:00:00 +0000 UTC
Koki: 1647-01-01 09:00:00 +0900 SUMERAGI, Eien (永延)

Documentation

Overview

Package sumeragi implements time in Japanese calendar(皇暦, 皇紀, 元号).

Example
now := Now()
r, _ := Era(now)
fmt.Printf("Now: Sumeragi(Koki) %v, %s Era\n", now, r)
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var JST = time.FixedZone("JST", 32400)
View Source
var SUMERAGI = time.FixedZone("SUMERAGI", 32400)

Functions

func Era

func Era(t time.Time) (string, string)

Era of Japan in Romaji and Kanji.

func Now

func Now() time.Time

Now in Japanese calendar.

func To

func To(t time.Time) time.Time

To time in Japanese calendar.

Types

This section is empty.

Jump to

Keyboard shortcuts

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