Documentation
¶
Index ¶
- Variables
- func GetChangShengFromNumber(nValue int) string
- func GetChnChar(nNumber int) string
- func GetChnCharFromYear(nYear int) string
- func GetDiZhiFromNumber(nValue int) string
- func GetGanZhiFromNumber(nValue int) string
- func GetJieQiDate(pSolarDate *TSolarDate) (*TJieQiDate, *TJieQiDate)
- func GetJieQiFromNumber(nValue int) string
- func GetLiChunYear(pSolarDate *TSolarDate) int
- func GetNaYinFromNumber(nValue int) string
- func GetShiShenFromNumber(nValue int) string
- func GetShiShenLongFromNumber(nValue int) string
- func GetTianGanFromNumber(nValue int) string
- func GetWuXingColorFromNumber(nValue int) string
- func GetWuXingFromNumber(nValue int) string
- func GetYearFirstMonthGanZhi(yGan int) int
- func GetYearFirstMonthGanZhiString(yGan string) string
- func GetYinYangFromNumber(nValue int) string
- type TBazi
- func (m *TBazi) DaYun() *TDaYun
- func (m *TBazi) Date() *TSolarDate
- func (m *TBazi) LunarDate() *TLunarDate
- func (m *TBazi) MingGong() *TGanZhi
- func (m *TBazi) QiYunDate() *TSolarDate
- func (m *TBazi) SiZhu() *TSiZhu
- func (m *TBazi) SolarData() *TSolarDate
- func (m *TBazi) String() string
- func (m *TBazi) TaiYuan() *TGanZhi
- func (m *TBazi) ToHTML() string
- type TBaziDate
- type TCangGan
- type TChangSheng
- type TDaYun
- type TGan
- type TGanZhi
- type THeHuaChong
- type TJieQi
- type TJieQiDate
- type TLunarDate
- func (m *TLunarDate) Day() string
- func (m *TLunarDate) Get64TimeStamp() int64
- func (m *TLunarDate) GetAllDays() int
- func (m *TLunarDate) GetDateIsValid() bool
- func (m *TLunarDate) GetDayTimeFrom64TimeStamp(nTimeStamp int64)
- func (m *TLunarDate) GetLeapMonth() int
- func (m *TLunarDate) GetMonthDays() int
- func (m *TLunarDate) GetMonthFrom64TimeStamp(nTimeStamp int64)
- func (m *TLunarDate) GetTimeIsValid(nHour, nMinute, nSecond int) bool
- func (m *TLunarDate) GetYearFrom64TimeStamp(nTimeStamp int64) *TLunarDate
- func (m *TLunarDate) Hour() string
- func (m *TLunarDate) Month() string
- func (m *TLunarDate) String() string
- func (m *TLunarDate) ToSolarDate() *TSolarDate
- func (m *TLunarDate) Year() string
- type TNaYin
- type TShiShen
- type TSiZhu
- type TSolarDate
- func (m *TSolarDate) Day() int
- func (m *TSolarDate) Get64TimeStamp() int64
- func (m *TSolarDate) GetAllDays() int
- func (m *TSolarDate) GetBasicDays(nYear, nMonth, nDay int) int
- func (m *TSolarDate) GetCalendarType(nYear, nMonth, nDay int) int
- func (m *TSolarDate) GetDateIsValid(nYear, nMonth, nDay int) bool
- func (m *TSolarDate) GetDayTimeFrom64TimeStamp(nTimeStamp int64)
- func (m *TSolarDate) GetDiffSeconds(other *TSolarDate) int64
- func (m *TSolarDate) GetIsLeapYear(nYear int) bool
- func (m *TSolarDate) GetLeapDays(nYear, nMonth, nDay int) int
- func (m *TSolarDate) GetMonthDays(nYear, nMonth int) int
- func (m *TSolarDate) GetMonthFrom64TimeStamp(nTimeStamp int64)
- func (m *TSolarDate) GetTimeIsValid(nHour, nMinute, nSecond int) bool
- func (m *TSolarDate) GetYearFrom64TimeStamp(nTimeStamp int64) *TSolarDate
- func (m *TSolarDate) Hour() int
- func (m *TSolarDate) Minute() int
- func (m *TSolarDate) Month() int
- func (m *TSolarDate) Second() int
- func (m *TSolarDate) String() string
- func (m *TSolarDate) ToBaziDate() *TBaziDate
- func (m *TSolarDate) ToLunarDate() *TLunarDate
- func (m *TSolarDate) Year() int
- type TTianGanWuHe
- type TWuXing
- type TXiYong
- type TYinYang
- type TZhi
- type TZhu
Constants ¶
This section is empty.
Variables ¶
var ChangSheng = [12]string{"长生", "沐浴", "冠带", "临官(禄)", "帝旺", "病", "衰", "死", "墓", "绝", "胎", "养"}
var ChangShengDict = [][]int{
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0},
{6, 5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7},
{10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
{9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10},
{10, 11, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
{9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10},
{7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6},
{0, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1},
{4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3},
{3, 2, 1, 0, 11, 10, 9, 8, 7, 6, 5, 4},
}
输入tgA,dzB,顺序为Gan,Zhi顺序, 从0开始,如 癸在未,则输入 (9,7)=8 墓 ;丁在午,输入(3,6)=3 临官
var Lichunlist = []*TSolarDate{}/* 2270 elements not displayed */
立春列表
var WuHuDunIntMap = map[int]int{
0: 2,
5: 2,
1: 14,
6: 14,
2: 26,
7: 26,
3: 38,
8: 38,
4: 50,
9: 50,
}
var WuHuDunMap = map[string]string{
"甲": "丙寅",
"己": "丙寅",
"乙": "戊寅",
"庚": "戊寅",
"丙": "庚寅",
"辛": "庚寅",
"丁": "壬寅",
"壬": "壬寅",
"戊": "甲寅",
"癸": "甲寅",
}
Functions ¶
func GetChangShengFromNumber ¶ added in v1.0.5
GetChangShengFromNumber 从数字获得长生名, 0-11
func GetChnChar ¶
func GetDiZhiFromNumber ¶
GetDiZhiFromNumber 从数字获得地支名, 0-9
func GetGanZhiFromNumber ¶
GetGanZhiFromNumber 从数字获得天干地支名, 0-59
func GetJieQiDate ¶
func GetJieQiDate(pSolarDate *TSolarDate) (*TJieQiDate, *TJieQiDate)
GetJieQiDate 获取某个日期的节气, 和前后两个节气的日期
func GetJieQiFromNumber ¶
GetJieQiFromNumber 从数字获得节气名, 0-23
func GetNaYinFromNumber ¶
GetNaYinFromNumber 从数字获得纳音名, 0-29
func GetShiShenFromNumber ¶
GetShiShenFromNumber 从数字获得十神名, 0-9
func GetShiShenLongFromNumber ¶
GetShiShenLongFromNumber 从数字获取十神长名, 0-9
func GetTianGanFromNumber ¶
GetTianGanFromNumber 从数字获得天干名, 0-9
func GetWuXingColorFromNumber ¶
GetWuXingColorFromNumber 获取五行的颜色
func GetWuXingFromNumber ¶
GetWuXingFromNumber 从数字获得五行名, 0-4
func GetYearFirstMonthGanZhi ¶ added in v1.0.4
func GetYearFirstMonthGanZhiString ¶ added in v1.0.4
func GetYinYangFromNumber ¶
GetYinYangFromNumber (阴 == 0, 阳 == 1)
Types ¶
type TBazi ¶
type TBazi struct {
// contains filtered or unexported fields
}
TBazi 八字大类
func NewBaziFromLunarDate ¶
func NewBaziFromLunarDate(pLunarDate *TLunarDate, nSex int) *TBazi
NewBaziFromLunarDate 新建八字 从农历
type TBaziDate ¶
type TBaziDate struct {
// contains filtered or unexported fields
}
TBaziDate 八字历法 八字历法的年 和 新历的 和 农历的都不一样. 八字历法是按照立春为1年. 然后每个节气为月
type TChangSheng ¶ added in v1.0.5
type TChangSheng int
TChangSheng 长生宫
func NewChangShengFromGan ¶ added in v1.0.5
func NewChangShengFromGan(nDayGan int, nZhi int) *TChangSheng
NewChangShengFromGan 从日干和目标支获取十神 nDayGan 日干 nZhi 目标支
func (*TChangSheng) String ¶ added in v1.0.5
func (m *TChangSheng) String() string
String 转换成可阅读的字符串
func (*TChangSheng) ToString ¶ added in v1.0.5
func (m *TChangSheng) ToString() string
ToString 转换成可阅读的字符串
type TGanZhi ¶
type TGanZhi int
TGanZhi 干支
func CombineGanZhi ¶
CombineGanZhi 将天干地支组合成干支,0-9 0-11 转换成 0-59
func NewGanZhiFromDay ¶
NewGanZhiFromDay 获得八字天的干支, 0-59 对应 甲子到癸亥
func NewGanZhiFromYear ¶
NewGanZhiFromYear 获得八字年的干支,0-59 对应 甲子到癸亥
func (*TGanZhi) ExtractGanZhi ¶
ExtractGanZhi 将干支拆分成天干地支,0-59 转换成 0-9 0-11
type TJieQiDate ¶
type TJieQiDate struct {
Year int // 年
Month int // 月
Day int // 日
Hour int // 时
Minute int // 分
Second int // 秒
JieQi TJieQi // 节气
}
TJieQiDate 节气
func (*TJieQiDate) ToSolarDate ¶
func (m *TJieQiDate) ToSolarDate() *TSolarDate
ToSolarDate 节气日期 转成 普通日期用
type TLunarDate ¶
type TLunarDate struct {
// contains filtered or unexported fields
}
TLunarDate 农历日期
func NewLunarDate ¶
NewLunarDate 新建一个农历日期, 顺序月
func NewLunarDateFrom64TimeStamp ¶
func NewLunarDateFrom64TimeStamp(nTimeStamp int64) *TLunarDate
NewLunarDateFrom64TimeStamp 从64位时间戳反推日期
func NewLunarDateFromLeap ¶
func NewLunarDateFromLeap(nYear int, nMonth int, nDay int, nHour int, nMinute int, nSecond int, isLeap bool) *TLunarDate
NewLunarDateFromLeap 新建一个农历日期, 带闰月
func (*TLunarDate) Get64TimeStamp ¶
func (m *TLunarDate) Get64TimeStamp() int64
Get64TimeStamp 获取64位时间戳
func (*TLunarDate) GetAllDays ¶
func (m *TLunarDate) GetAllDays() int
GetAllDays 获取距离公元原点的日数, 这里是农历来的年月日
func (*TLunarDate) GetDateIsValid ¶
func (m *TLunarDate) GetDateIsValid() bool
GetDateIsValid 返回日期是否合法
func (*TLunarDate) GetDayTimeFrom64TimeStamp ¶
func (m *TLunarDate) GetDayTimeFrom64TimeStamp(nTimeStamp int64)
GetDayTimeFrom64TimeStamp 从64位时间戳反推其他参数
func (*TLunarDate) GetMonthDays ¶
func (m *TLunarDate) GetMonthDays() int
GetMonthDays 获取某农历年的第N个月是大月30天还是小月29天
func (*TLunarDate) GetMonthFrom64TimeStamp ¶
func (m *TLunarDate) GetMonthFrom64TimeStamp(nTimeStamp int64)
GetMonthFrom64TimeStamp .
func (*TLunarDate) GetTimeIsValid ¶ added in v1.0.15
func (m *TLunarDate) GetTimeIsValid(nHour, nMinute, nSecond int) bool
GetTimeIsValid 检查时间是否合法
func (*TLunarDate) GetYearFrom64TimeStamp ¶
func (m *TLunarDate) GetYearFrom64TimeStamp(nTimeStamp int64) *TLunarDate
GetYearFrom64TimeStamp 从64位时间戳反推年
func (*TLunarDate) String ¶
func (m *TLunarDate) String() string
type TShiShen ¶
type TShiShen int
TShiShen 十神
func NewShiShenFromGan ¶
NewShiShenFromGan 从日干和目标干获取十神 nDayGan 日干 Gan2 目标干
type TSolarDate ¶
type TSolarDate struct {
// contains filtered or unexported fields
}
TSolarDate 日期
func NewQiYun ¶
func NewQiYun(isShunNi bool, dtPreviousJie *TSolarDate, dtNextJie *TSolarDate, dtSolarDate *TSolarDate) *TSolarDate
NewQiYun 起运时间
func NewSolarDate ¶
func NewSolarDate(nYear, nMonth, nDay, nHour, nMinute, nSecond int) *TSolarDate
NewSolarDate 创建一个新历时间
func NewSolarDateFrom64TimeStamp ¶
func NewSolarDateFrom64TimeStamp(nTimeStamp int64) *TSolarDate
NewSolarDateFrom64TimeStamp 从64位时间戳反推日期
func (*TSolarDate) Get64TimeStamp ¶
func (m *TSolarDate) Get64TimeStamp() int64
Get64TimeStamp 生成64位时间戳
func (*TSolarDate) GetAllDays ¶
func (m *TSolarDate) GetAllDays() int
GetAllDays 获得距公元原点的日数 这里是公历的年月日
func (*TSolarDate) GetBasicDays ¶
func (m *TSolarDate) GetBasicDays(nYear, nMonth, nDay int) int
GetBasicDays 获取基本数据
func (*TSolarDate) GetCalendarType ¶
func (m *TSolarDate) GetCalendarType(nYear, nMonth, nDay int) int
GetCalendarType 根据公历日期判断当时历法
func (*TSolarDate) GetDateIsValid ¶
func (m *TSolarDate) GetDateIsValid(nYear, nMonth, nDay int) bool
GetDateIsValid 返回公历日期是否合法
func (*TSolarDate) GetDayTimeFrom64TimeStamp ¶
func (m *TSolarDate) GetDayTimeFrom64TimeStamp(nTimeStamp int64)
GetDayTimeFrom64TimeStamp 从64位时间戳反推其他参数
func (*TSolarDate) GetDiffSeconds ¶
func (m *TSolarDate) GetDiffSeconds(other *TSolarDate) int64
GetDiffSeconds 获取两个日期之间相差的秒数
func (*TSolarDate) GetIsLeapYear ¶
func (m *TSolarDate) GetIsLeapYear(nYear int) bool
GetIsLeapYear 返回某公历是否闰年
func (*TSolarDate) GetLeapDays ¶
func (m *TSolarDate) GetLeapDays(nYear, nMonth, nDay int) int
GetLeapDays 获取闰年天数
func (*TSolarDate) GetMonthDays ¶
func (m *TSolarDate) GetMonthDays(nYear, nMonth int) int
GetMonthDays 取本月天数,不考虑 1582 年 10 月的特殊情况
func (*TSolarDate) GetMonthFrom64TimeStamp ¶
func (m *TSolarDate) GetMonthFrom64TimeStamp(nTimeStamp int64)
GetMonthFrom64TimeStamp 从64位时间戳反推月,
func (*TSolarDate) GetTimeIsValid ¶ added in v1.0.15
func (m *TSolarDate) GetTimeIsValid(nHour, nMinute, nSecond int) bool
GetTimeIsValid 检查时间是否合法
func (*TSolarDate) GetYearFrom64TimeStamp ¶
func (m *TSolarDate) GetYearFrom64TimeStamp(nTimeStamp int64) *TSolarDate
GetYearFrom64TimeStamp 从64位时间戳反推年
func (*TSolarDate) String ¶
func (m *TSolarDate) String() string
type TWuXing ¶
type TWuXing int
TWuXing 五行
func GetWuXingFromGan ¶
GetWuXingFromGan 获得某干的五行,0-4 对应 金木水火土 甲乙为木,丙丁为火,戊己为土,庚辛为金,壬癸为水,
type TZhu ¶
type TZhu struct {
// contains filtered or unexported fields
}
TZhu 柱