Documentation
¶
Overview ¶
Package code from: https://github.com/golang-module/carbon
Index ¶
- Constants
- func AddOffsetTime(t time.Duration)
- func GetAbsValue(value int64) int64
- func ParseByDuration(duration string) (time.Duration, error)
- func SetOffsetLocation(name string) (err error)
- func SubOffsetTime(t time.Duration)
- type ActorGoTime
- func CreateFromDate(year int, month int, day int) ActorGoTime
- func CreateFromDateTime(year int, month int, day int, hour int, minute int, second int) ActorGoTime
- func CreateFromTime(hour int, minute int, second int) ActorGoTime
- func CreateFromTimestamp(timestamp int64) ActorGoTime
- func NewMillisecond(millisecond int64) ActorGoTime
- func NewSecond(second int64) ActorGoTime
- func NewTime(tt time.Time, setGlobal bool) ActorGoTime
- func Now() ActorGoTime
- func Tomorrow() ActorGoTime
- func Yesterday() ActorGoTime
- func (c *ActorGoTime) AddCenturies(centuries int)
- func (c *ActorGoTime) AddCenturiesNoOverflow(centuries int)
- func (c *ActorGoTime) AddCentury()
- func (c *ActorGoTime) AddCenturyNoOverflow()
- func (c *ActorGoTime) AddDay()
- func (c *ActorGoTime) AddDays(days int)
- func (c *ActorGoTime) AddDuration(duration string) error
- func (c *ActorGoTime) AddHour()
- func (c *ActorGoTime) AddHours(hours int)
- func (c *ActorGoTime) AddMinute()
- func (c *ActorGoTime) AddMinutes(minutes int)
- func (c *ActorGoTime) AddMonth()
- func (c *ActorGoTime) AddMonthNoOverflow()
- func (c *ActorGoTime) AddMonths(months int)
- func (c *ActorGoTime) AddMonthsNoOverflow(months int)
- func (c *ActorGoTime) AddQuarter()
- func (c *ActorGoTime) AddQuarterNoOverflow()
- func (c *ActorGoTime) AddQuarters(quarters int)
- func (c *ActorGoTime) AddQuartersNoOverflow(quarters int)
- func (c *ActorGoTime) AddSecond()
- func (c *ActorGoTime) AddSeconds(seconds int)
- func (c *ActorGoTime) AddWeek()
- func (c *ActorGoTime) AddWeeks(weeks int)
- func (c *ActorGoTime) AddYear()
- func (c *ActorGoTime) AddYearNoOverflow()
- func (c *ActorGoTime) AddYears(years int)
- func (c *ActorGoTime) AddYearsNoOverflow(years int)
- func (c ActorGoTime) Copy() ActorGoTime
- func (c ActorGoTime) Day() int
- func (c ActorGoTime) DayOfMonth() int
- func (c ActorGoTime) DayOfWeek() int
- func (c ActorGoTime) DayOfYear() int
- func (c ActorGoTime) DaysInMonth() int
- func (c ActorGoTime) DaysInYear() int
- func (c ActorGoTime) DiffInDays(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInDaysWithAbs(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInHours(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInHoursWithAbs(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInMicrosecond(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInMillisecond(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInMinutes(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInMinutesWithAbs(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInMonths(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInMonthsWithAbs(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInNanosecond(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInSeconds(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInSecondsWithAbs(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInWeeks(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInWeeksWithAbs(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInYears(end *ActorGoTime) int64
- func (c ActorGoTime) DiffInYearsWithAbs(end *ActorGoTime) int64
- func (c ActorGoTime) EndOfDay() ActorGoTime
- func (c ActorGoTime) EndOfHour() ActorGoTime
- func (c ActorGoTime) EndOfMinute() ActorGoTime
- func (c ActorGoTime) EndOfMonth() ActorGoTime
- func (c ActorGoTime) EndOfSecond() ActorGoTime
- func (c ActorGoTime) EndOfWeek() ActorGoTime
- func (c ActorGoTime) EndOfYear() ActorGoTime
- func (c ActorGoTime) Hour() int
- func (c ActorGoTime) IsApril() bool
- func (c ActorGoTime) IsAugust() bool
- func (c ActorGoTime) IsDecember() bool
- func (c ActorGoTime) IsFebruary() bool
- func (c ActorGoTime) IsFriday() bool
- func (c ActorGoTime) IsFuture() bool
- func (c ActorGoTime) IsJanuary() bool
- func (c ActorGoTime) IsJuly() bool
- func (c ActorGoTime) IsJune() bool
- func (c ActorGoTime) IsLeapYear() bool
- func (c ActorGoTime) IsLongYear() bool
- func (c ActorGoTime) IsMarch() bool
- func (c ActorGoTime) IsMay() bool
- func (c ActorGoTime) IsMonday() bool
- func (c ActorGoTime) IsNovember() bool
- func (c ActorGoTime) IsNow() bool
- func (c ActorGoTime) IsOctober() bool
- func (c ActorGoTime) IsPast() bool
- func (c ActorGoTime) IsSaturday() bool
- func (c ActorGoTime) IsSeptember() bool
- func (c ActorGoTime) IsSunday() bool
- func (c ActorGoTime) IsThursday() bool
- func (c ActorGoTime) IsToday() bool
- func (c ActorGoTime) IsTomorrow() bool
- func (c ActorGoTime) IsTuesday() bool
- func (c ActorGoTime) IsWednesday() bool
- func (c ActorGoTime) IsWeekday() bool
- func (c ActorGoTime) IsWeekend() bool
- func (c ActorGoTime) IsYesterday() bool
- func (c ActorGoTime) Microsecond() int
- func (c ActorGoTime) Millisecond() int
- func (c ActorGoTime) Minute() int
- func (c ActorGoTime) Month() int
- func (c ActorGoTime) MonthOfYear() int
- func (c ActorGoTime) Nanosecond() int
- func (c ActorGoTime) NowDiffMillisecond() int64
- func (c ActorGoTime) NowDiffSecond() int64
- func (c ActorGoTime) Quarter() int
- func (c ActorGoTime) Second() int
- func (c *ActorGoTime) SetDate(year, month, day int)
- func (c *ActorGoTime) SetDay(day int)
- func (c *ActorGoTime) SetHour(hour int)
- func (c *ActorGoTime) SetMinute(minute int)
- func (c *ActorGoTime) SetMonth(month int)
- func (c *ActorGoTime) SetNanoSecond(nanoSecond int)
- func (c *ActorGoTime) SetSecond(second int)
- func (c *ActorGoTime) SetTime(hour, mintue, second, nanoSecond int)
- func (c *ActorGoTime) SetTimezone(timezone string) error
- func (c *ActorGoTime) SetYear(year int)
- func (c ActorGoTime) StartOfDay() ActorGoTime
- func (c ActorGoTime) StartOfHour() ActorGoTime
- func (c ActorGoTime) StartOfMinute() ActorGoTime
- func (c ActorGoTime) StartOfMonth() ActorGoTime
- func (c ActorGoTime) StartOfSecond() ActorGoTime
- func (c ActorGoTime) StartOfWeek() ActorGoTime
- func (c ActorGoTime) StartOfYear() ActorGoTime
- func (c *ActorGoTime) SubCenturies(centuries int)
- func (c *ActorGoTime) SubCenturiesNoOverflow(centuries int)
- func (c *ActorGoTime) SubCentury()
- func (c *ActorGoTime) SubCenturyNoOverflow()
- func (c *ActorGoTime) SubDay()
- func (c *ActorGoTime) SubDays(days int)
- func (c *ActorGoTime) SubDuration(duration string) error
- func (c *ActorGoTime) SubHour()
- func (c *ActorGoTime) SubHours(hours int)
- func (c *ActorGoTime) SubMinute()
- func (c *ActorGoTime) SubMinutes(minutes int)
- func (c *ActorGoTime) SubMonth()
- func (c *ActorGoTime) SubMonthNoOverflow()
- func (c *ActorGoTime) SubMonths(months int)
- func (c *ActorGoTime) SubMonthsNoOverflow(months int)
- func (c *ActorGoTime) SubQuarter()
- func (c *ActorGoTime) SubQuarterNoOverflow()
- func (c *ActorGoTime) SubQuarters(quarters int)
- func (c *ActorGoTime) SubQuartersNoOverflow(quarters int)
- func (c *ActorGoTime) SubSecond()
- func (c *ActorGoTime) SubSeconds(seconds int)
- func (c *ActorGoTime) SubWeek()
- func (c *ActorGoTime) SubWeeks(weeks int)
- func (c *ActorGoTime) SubYear()
- func (c *ActorGoTime) SubYearNoOverflow()
- func (c *ActorGoTime) SubYears(years int)
- func (c *ActorGoTime) SubYearsNoOverflow(years int)
- func (c ActorGoTime) Timezone() string
- func (c ActorGoTime) ToDateFormat() string
- func (c ActorGoTime) ToDateMillisecondFormat() string
- func (c ActorGoTime) ToDateTimeFormat() string
- func (c ActorGoTime) ToMicrosecond() int64
- func (c ActorGoTime) ToMillisecond() int64
- func (c ActorGoTime) ToMillisecondString() string
- func (c ActorGoTime) ToNanosecond() int64
- func (c ActorGoTime) ToSecond() int64
- func (c ActorGoTime) ToShortDateFormat() string
- func (c ActorGoTime) ToShortDateTimeFormat() string
- func (c ActorGoTime) ToShortIntDateFormat() int32
- func (c ActorGoTime) ToShortTimeFormat() string
- func (c ActorGoTime) ToTimeFormat() string
- func (c ActorGoTime) Week() int
- func (c ActorGoTime) WeekOfMonth() int
- func (c ActorGoTime) WeekOfYear() int
- func (c ActorGoTime) Year() int
Constants ¶
const ( YearsPerMillennium = 1000 // 每千年1000年 YearsPerCentury = 100 // 每世纪100年 YearsPerDecade = 10 // 每十年10年 QuartersPerYear = 4 // 每年4季度 MonthsPerYear = 12 // 每年12月 MonthsPerQuarter = 3 // 每季度3月 WeeksPerNormalYear = 52 // 每常规年52周 WeeksPerMonth = 4 // 每月4周 DaysPerLeapYear = 366 // 每闰年366天 DaysPerNormalYear = 365 // 每常规年365天 DaysPerWeek = 7 // 每周7天 HoursPerWeek = 168 // 每周168小时 HoursPerDay = 24 // 每天24小时 MinutesPerDay = 1440 // 每天1440分钟 MinutesPerHour = 60 // 每小时60分钟 SecondsPerWeek = 604800 // 每周604800秒 SecondsPerDay = 86400 // 每天86400秒 SecondsPerHour = 3600 // 每小时3600秒 SecondsPerMinute = 60 // 每分钟60秒 MillisecondsPerSecond = 1000 // 每秒1000毫秒 MillisecondsPerMinute = 60000 // 每分钟60000毫秒 MillisecondsPerDay = 86400000 // 每天86400000毫秒 MillisecondsPerHour = 3600000 // 每小时3600000毫秒 MicrosecondsPerMillisecond = 1000 // 每毫秒1000微秒 MicrosecondsPerSecond = 1000000 // 每秒1000000微秒 WeeksPerLongYear = 53 // 每长年53周 DateTimeMillisecondFormat = "2006-01-02 15:04:05.000" DateTimeFormat = "2006-01-02 15:04:05" DateFormat = "2006-01-02" TimeFormat = "15:04:05" ShortDateTimeFormat = "20060102150405" ShortDateFormat = "20060102" ShortTimeFormat = "150405" )
Variables ¶
This section is empty.
Functions ¶
func AddOffsetTime ¶
func ParseByDuration ¶
ParseByDuration 通过持续时间解析
func SetOffsetLocation ¶
func SubOffsetTime ¶
Types ¶
type ActorGoTime ¶
func CreateFromDate ¶
func CreateFromDate(year int, month int, day int) ActorGoTime
CreateFromDate 从年月日创建 Carbon 实例(默认时区)
func CreateFromDateTime ¶
CreateFromDateTime 从年月日时分秒创建 Carbon 实例
func CreateFromTime ¶
func CreateFromTime(hour int, minute int, second int) ActorGoTime
CreateFromTime 从时分秒创建 Carbon 实例(默认时区)
func CreateFromTimestamp ¶
func CreateFromTimestamp(timestamp int64) ActorGoTime
CreateFromTimestamp 从时间戳创建 Carbon 实例
func NewMillisecond ¶
func NewMillisecond(millisecond int64) ActorGoTime
func NewSecond ¶
func NewSecond(second int64) ActorGoTime
func Now ¶
func Now() ActorGoTime
func Tomorrow ¶
func Tomorrow() ActorGoTime
func Yesterday ¶
func Yesterday() ActorGoTime
func (*ActorGoTime) AddCenturies ¶
func (c *ActorGoTime) AddCenturies(centuries int)
AddCenturies N世纪后
func (*ActorGoTime) AddCenturiesNoOverflow ¶
func (c *ActorGoTime) AddCenturiesNoOverflow(centuries int)
AddCenturiesNoOverflow N世纪后(月份不溢出)
func (*ActorGoTime) AddCenturyNoOverflow ¶
func (c *ActorGoTime) AddCenturyNoOverflow()
AddCenturyNoOverflow 1世纪后(月份不溢出)
func (*ActorGoTime) AddDuration ¶
func (c *ActorGoTime) AddDuration(duration string) error
AddDuration 按照持续时间字符串增加时间 支持整数/浮点数和符号ns(纳秒)、us(微妙)、ms(毫秒)、s(秒)、m(分钟)、h(小时)的组合
func (*ActorGoTime) AddMonthNoOverflow ¶
func (c *ActorGoTime) AddMonthNoOverflow()
AddMonthNoOverflow 1月后(月份不溢出)
func (*ActorGoTime) AddMonthsNoOverflow ¶
func (c *ActorGoTime) AddMonthsNoOverflow(months int)
AddMonthsNoOverflow N月后(月份不溢出)
func (*ActorGoTime) AddQuarterNoOverflow ¶
func (c *ActorGoTime) AddQuarterNoOverflow()
AddQuarterNoOverflow 1季度后(月份不溢出)
func (*ActorGoTime) AddQuartersNoOverflow ¶
func (c *ActorGoTime) AddQuartersNoOverflow(quarters int)
AddQuartersNoOverflow N季度后(月份不溢出)
func (*ActorGoTime) AddYearNoOverflow ¶
func (c *ActorGoTime) AddYearNoOverflow()
AddYearNoOverflow 1年后(月份不溢出)
func (*ActorGoTime) AddYearsNoOverflow ¶
func (c *ActorGoTime) AddYearsNoOverflow(years int)
AddYearsNoOverflow N年后(月份不溢出)
func (ActorGoTime) DiffInDays ¶
func (c ActorGoTime) DiffInDays(end *ActorGoTime) int64
DiffInDays 相差多少天
func (ActorGoTime) DiffInDaysWithAbs ¶
func (c ActorGoTime) DiffInDaysWithAbs(end *ActorGoTime) int64
DiffInDaysWithAbs 相差多少天(绝对值)
func (ActorGoTime) DiffInHours ¶
func (c ActorGoTime) DiffInHours(end *ActorGoTime) int64
DiffInHours 相差多少小时
func (ActorGoTime) DiffInHoursWithAbs ¶
func (c ActorGoTime) DiffInHoursWithAbs(end *ActorGoTime) int64
DiffInHoursWithAbs 相差多少小时(绝对值)
func (ActorGoTime) DiffInMicrosecond ¶
func (c ActorGoTime) DiffInMicrosecond(end *ActorGoTime) int64
DiffInMicrosecond 相差多少微秒
func (ActorGoTime) DiffInMillisecond ¶
func (c ActorGoTime) DiffInMillisecond(end *ActorGoTime) int64
DiffInMillisecond 相差多少毫秒
func (ActorGoTime) DiffInMinutes ¶
func (c ActorGoTime) DiffInMinutes(end *ActorGoTime) int64
DiffInMinutes 相差多少分钟
func (ActorGoTime) DiffInMinutesWithAbs ¶
func (c ActorGoTime) DiffInMinutesWithAbs(end *ActorGoTime) int64
DiffInMinutesWithAbs 相差多少分钟(绝对值)
func (ActorGoTime) DiffInMonths ¶
func (c ActorGoTime) DiffInMonths(end *ActorGoTime) int64
DiffInMonths 相差多少月
func (ActorGoTime) DiffInMonthsWithAbs ¶
func (c ActorGoTime) DiffInMonthsWithAbs(end *ActorGoTime) int64
DiffInMonthsWithAbs 相差多少月(绝对值)
func (ActorGoTime) DiffInNanosecond ¶
func (c ActorGoTime) DiffInNanosecond(end *ActorGoTime) int64
DiffINanosecond 相差多少纳秒
func (ActorGoTime) DiffInSeconds ¶
func (c ActorGoTime) DiffInSeconds(end *ActorGoTime) int64
DiffInSeconds 相差多少秒
func (ActorGoTime) DiffInSecondsWithAbs ¶
func (c ActorGoTime) DiffInSecondsWithAbs(end *ActorGoTime) int64
DiffInSecondsWithAbs 相差多少秒(绝对值)
func (ActorGoTime) DiffInWeeks ¶
func (c ActorGoTime) DiffInWeeks(end *ActorGoTime) int64
DiffInWeeks 相差多少周
func (ActorGoTime) DiffInWeeksWithAbs ¶
func (c ActorGoTime) DiffInWeeksWithAbs(end *ActorGoTime) int64
DiffInWeeksWithAbs 相差多少周(绝对值)
func (ActorGoTime) DiffInYears ¶
func (c ActorGoTime) DiffInYears(end *ActorGoTime) int64
DiffInYears 相差多少年
func (ActorGoTime) DiffInYearsWithAbs ¶
func (c ActorGoTime) DiffInYearsWithAbs(end *ActorGoTime) int64
DiffInYearsWithAbs 相差多少年(绝对值)
func (ActorGoTime) NowDiffMillisecond ¶
func (c ActorGoTime) NowDiffMillisecond() int64
DiffInNowMillisecond 与当前时间相差多少毫秒
func (ActorGoTime) NowDiffSecond ¶
func (c ActorGoTime) NowDiffSecond() int64
DiffInNowMillisecond 与当前时间相差多少秒
func (*ActorGoTime) SetDate ¶
func (c *ActorGoTime) SetDate(year, month, day int)
func (*ActorGoTime) SetNanoSecond ¶
func (c *ActorGoTime) SetNanoSecond(nanoSecond int)
SetNanoSecond 设置纳秒
func (*ActorGoTime) SetTime ¶
func (c *ActorGoTime) SetTime(hour, mintue, second, nanoSecond int)
func (*ActorGoTime) SetTimezone ¶
func (c *ActorGoTime) SetTimezone(timezone string) error
func (ActorGoTime) StartOfMinute ¶
func (c ActorGoTime) StartOfMinute() ActorGoTime
StartOfMinute 分钟开始时间
func (ActorGoTime) StartOfMonth ¶
func (c ActorGoTime) StartOfMonth() ActorGoTime
StartOfMonth 本月开始时间
func (ActorGoTime) StartOfSecond ¶
func (c ActorGoTime) StartOfSecond() ActorGoTime
StartOfSecond 秒开始时间
func (*ActorGoTime) SubCenturies ¶
func (c *ActorGoTime) SubCenturies(centuries int)
SubCenturies N世纪前
func (*ActorGoTime) SubCenturiesNoOverflow ¶
func (c *ActorGoTime) SubCenturiesNoOverflow(centuries int)
SubCenturiesNoOverflow N世纪前(月份不溢出)
func (*ActorGoTime) SubCenturyNoOverflow ¶
func (c *ActorGoTime) SubCenturyNoOverflow()
SubCenturyNoOverflow 1世纪前(月份不溢出)
func (*ActorGoTime) SubDuration ¶
func (c *ActorGoTime) SubDuration(duration string) error
SubDuration 按照持续时间字符串减少时间 支持整数/浮点数和符号ns(纳秒)、us(微妙)、ms(毫秒)、s(秒)、m(分钟)、h(小时)的组合
func (*ActorGoTime) SubMonthNoOverflow ¶
func (c *ActorGoTime) SubMonthNoOverflow()
SubMonthNoOverflow 1月前(月份不溢出)
func (*ActorGoTime) SubMonthsNoOverflow ¶
func (c *ActorGoTime) SubMonthsNoOverflow(months int)
SubMonthsNoOverflow N月前(月份不溢出)
func (*ActorGoTime) SubQuarterNoOverflow ¶
func (c *ActorGoTime) SubQuarterNoOverflow()
SubQuarterNoOverflow 1季度前(月份不溢出)
func (*ActorGoTime) SubQuartersNoOverflow ¶
func (c *ActorGoTime) SubQuartersNoOverflow(quarters int)
SubQuartersNoOverflow N季度前(月份不溢出)
func (*ActorGoTime) SubYearNoOverflow ¶
func (c *ActorGoTime) SubYearNoOverflow()
SubYearNoOverflow 1年前(月份不溢出)
func (*ActorGoTime) SubYearsNoOverflow ¶
func (c *ActorGoTime) SubYearsNoOverflow(years int)
SubYearsNoOverflow N年前(月份不溢出)
func (ActorGoTime) ToDateFormat ¶
func (c ActorGoTime) ToDateFormat() string
ToDateFormat 2006-01-02
func (ActorGoTime) ToDateMillisecondFormat ¶
func (c ActorGoTime) ToDateMillisecondFormat() string
ToDateMillisecondFormat 2023-04-10 12:26:57.420
func (ActorGoTime) ToDateTimeFormat ¶
func (c ActorGoTime) ToDateTimeFormat() string
ToDateTimeFormat 2006-01-02 15:04:05
func (ActorGoTime) ToMicrosecond ¶
func (c ActorGoTime) ToMicrosecond() int64
ToMicrosecond 输出微秒级时间戳
func (ActorGoTime) ToMillisecond ¶
func (c ActorGoTime) ToMillisecond() int64
ToMillisecond 输出毫秒级时间戳
func (ActorGoTime) ToMillisecondString ¶
func (c ActorGoTime) ToMillisecondString() string
func (ActorGoTime) ToShortDateFormat ¶
func (c ActorGoTime) ToShortDateFormat() string
ToShortDateFormat 20060102
func (ActorGoTime) ToShortDateTimeFormat ¶
func (c ActorGoTime) ToShortDateTimeFormat() string
ToShortDateTimeFormat 20060102150405
func (ActorGoTime) ToShortIntDateFormat ¶
func (c ActorGoTime) ToShortIntDateFormat() int32
ToShortIntDateFormat 20060102
func (ActorGoTime) ToShortTimeFormat ¶
func (c ActorGoTime) ToShortTimeFormat() string
ToShortTimeFormat 150405