chronos

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 4 Imported by: 1

README

Calendar Date object interface

 chronos.New() //Create current time
 chronos.New(time.Now()) //The parameter is of type time.Time
 chronos.New("2017/11/14 08:17") //Parameter is a specified format string

Lunar 农历日期显示

chronos.New().Lunar() //Get the lunar calendar

Solar 公历日期显示

chornos.New().Solar() //Get the solar calendar

Documentation

Index

Constants

View Source
const DateFormat = "2006/01/02 15:04"

DateFormat ...

View Source
const LunarDateFormat = "2006/01/02"

Variables

This section is empty.

Functions

func GetAstro

func GetAstro(m, d int) string

GetAstro 取得星座

func GetLunarInfo

func GetLunarInfo(y int) int

GetLunarInfo 取得月历信息

func GetStemBranch

func GetStemBranch(y int) string

GetStemBranch 取得干支

func GetTermInfo

func GetTermInfo(y, n int) int

GetTermInfo ...

func GetZodiac

func GetZodiac(lunar *Lunar) string

GetZodiac ...

func Solar2Lunar

func Solar2Lunar(time time.Time) string

Solar2Lunar 输入日历输出月历

func StemBranchDay

func StemBranchDay(y, m, d int) string

StemBranchDay 获取日柱

func StemBranchHour

func StemBranchHour(y, m, d, h int) string

StemBranchHour 获取时柱   子   丑   寅   卯   辰   己    23-01:01-03:03-05 :05-07:07-09:09-11    午   未   申   酉   戊   亥    11-13:13-15:15-17:17-19:19-21:21-23 `甲子`, `乙丑`, `丙寅`, `丁卯`, `戊辰`, `己巳`, `庚午`, `辛未`, `壬申`, `癸酉`, `甲戌`, `乙亥`, //甲或己日 `丙子`, `丁丑`, `戊寅`, `己卯`, `庚辰`, `辛巳`, `壬午`, `癸未`, `甲申`, `乙酉`, `丙戌`, `丁亥`, //乙或庚日 `戊子`, `己丑`, `庚寅`, `辛卯`, `壬辰`, `癸巳`, `甲午`, `乙未`, `丙申`, `丁酉`, `戊戌`, `己亥`, //丙或辛日 `庚子`, `辛丑`, `壬寅`, `癸卯`, `甲辰`, `乙巳`, `丙午`, `丁未`, `戊申`, `己酉`, `庚戌`, `辛亥`, //丁或壬日 `壬子`, `癸丑`, `甲寅`, `乙卯`, `丙辰`, `丁巳`, `戊午`, `己未`, `庚申`, `辛酉`, `壬戌`, `癸亥`, //戊或癸日

func StemBranchMonth

func StemBranchMonth(y, m, d int) string

StemBranchMonth 获取月柱

func StemBranchYear

func StemBranchYear(y int) string

StemBranchYear 获取年柱

Types

type Calendar

type Calendar interface {
	Lunar() *Lunar
	Solar() *Solar
	LunarDate() string
}

Calendar ...

func New

func New(v ...interface{}) Calendar

New can input three type of time to create the calendar "2006/01/02 03:04" format string time.Time value or nil to create a new time.Now() value

type Lunar

type Lunar struct {
	time.Time
	// contains filtered or unexported fields
}

Lunar ...

func CalculateLunar

func CalculateLunar(date string) *Lunar

CalculateLunar ...

func (*Lunar) Calendar

func (lunar *Lunar) Calendar() Calendar

Calendar ...

func (*Lunar) Date

func (lunar *Lunar) Date() string

Date ...

func (*Lunar) EightCharacter

func (lunar *Lunar) EightCharacter() []string

EightCharacter ...

func (*Lunar) FixLiChun added in v0.0.2

func (lunar *Lunar) FixLiChun(fix int)

func (*Lunar) Type

func (lunar *Lunar) Type() string

Type ...

type Solar

type Solar struct {
	// contains filtered or unexported fields
}

Solar is a calendar that represents a solar calendar.

func NewSolar

func NewSolar(calendar Calendar) *Solar

NewSolar can input three type of time to create the calendar

func (*Solar) Time

func (s *Solar) Time() time.Time

Time get the time of the calendar

Jump to

Keyboard shortcuts

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