代码拉取完成,页面将自动刷新
package carbon
import (
"gitee.com/dromara/carbon/v2/calendar/julian"
"gitee.com/dromara/carbon/v2/calendar/lunar"
"gitee.com/dromara/carbon/v2/calendar/persian"
)
// Lunar converts Carbon instance to Lunar instance.
// 将 Carbon 实例转化为 Lunar 实例
func (c Carbon) Lunar() (l lunar.Lunar) {
if c.Error != nil {
l.Error = c.Error
return
}
return lunar.FromGregorian(c.StdTime()).ToLunar()
}
// CreateFromLunar creates a Carbon instance from Lunar date and time.
// 从 农历日期 创建 Carbon 实例
func CreateFromLunar(year, month, day, hour, minute, second int, isLeapMonth bool) Carbon {
t := lunar.FromLunar(year, month, day, hour, minute, second, isLeapMonth).ToGregorian().Time
return CreateFromStdTime(t)
}
// Julian converts Carbon instance to Julian instance.
// 将 Carbon 实例转化为 Julian 实例
func (c Carbon) Julian() (j julian.Julian) {
if c.Error != nil {
return
}
return julian.FromGregorian(c.StdTime()).ToJulian()
}
// CreateFromJulian creates a Carbon instance from Julian Day or Modified Julian Day.
// 从 儒略日/简化儒略日 创建 Carbon 实例
func CreateFromJulian(f float64) Carbon {
t := julian.FromJulian(f).ToGregorian().Time
return CreateFromStdTime(t)
}
// Persian converts Carbon instance to Persian instance.
// 将 Carbon 实例转化为 Persian 实例
func (c Carbon) Persian() (p persian.Persian) {
if c.Error != nil {
return
}
return persian.FromGregorian(c.StdTime()).ToPersian()
}
// CreateFromPersian creates a Carbon instance from Persian date and time.
// 从 波斯日期 创建 Carbon 实例
func CreateFromPersian(year, month, day, hour, minute, second int) Carbon {
t := persian.FromPersian(year, month, day, hour, minute, second).ToGregorian().Time
return CreateFromStdTime(t)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。