Documentation ¶
Overview ¶
Package cherryTime code from: https://github.com/golang-module/carbon
Index ¶
- Constants
- func AddGlobalOffset(second int)
- func GetAbsValue(value int64) int64
- func ParseByDuration(duration string) (time.Duration, error)
- func SetGlobalLocation(name string) (err error)
- func SubGlobalOffset(second int)
- type CherryTime
- func CreateFromDate(year int, month int, day int) CherryTime
- func CreateFromDateTime(year int, month int, day int, hour int, minute int, second int) CherryTime
- func CreateFromTime(hour int, minute int, second int) CherryTime
- func CreateFromTimestamp(timestamp int64) CherryTime
- func NewTime(tt time.Time, setGlobal bool) CherryTime
- func Now() CherryTime
- func Tomorrow() CherryTime
- func Yesterday() CherryTime
- func (c *CherryTime) AddCenturies(centuries int)
- func (c *CherryTime) AddCenturiesNoOverflow(centuries int)
- func (c *CherryTime) AddCentury()
- func (c *CherryTime) AddCenturyNoOverflow()
- func (c *CherryTime) AddDay()
- func (c *CherryTime) AddDays(days int)
- func (c *CherryTime) AddDuration(duration string) error
- func (c *CherryTime) AddHour()
- func (c *CherryTime) AddHours(hours int)
- func (c *CherryTime) AddMinute()
- func (c *CherryTime) AddMinutes(minutes int)
- func (c *CherryTime) AddMonth()
- func (c *CherryTime) AddMonthNoOverflow()
- func (c *CherryTime) AddMonths(months int)
- func (c *CherryTime) AddMonthsNoOverflow(months int)
- func (c *CherryTime) AddQuarter()
- func (c *CherryTime) AddQuarterNoOverflow()
- func (c *CherryTime) AddQuarters(quarters int)
- func (c *CherryTime) AddQuartersNoOverflow(quarters int)
- func (c *CherryTime) AddSecond()
- func (c *CherryTime) AddSeconds(seconds int)
- func (c *CherryTime) AddWeek()
- func (c *CherryTime) AddWeeks(weeks int)
- func (c *CherryTime) AddYear()
- func (c *CherryTime) AddYearNoOverflow()
- func (c *CherryTime) AddYears(years int)
- func (c *CherryTime) AddYearsNoOverflow(years int)
- func (c CherryTime) Day() int
- func (c CherryTime) DayOfMonth() int
- func (c CherryTime) DayOfWeek() int
- func (c CherryTime) DayOfYear() int
- func (c CherryTime) DaysInMonth() int
- func (c CherryTime) DaysInYear() int
- func (c CherryTime) DiffInDays(end CherryTime) int64
- func (c CherryTime) DiffInDaysWithAbs(end CherryTime) int64
- func (c CherryTime) DiffInHours(end CherryTime) int64
- func (c CherryTime) DiffInHoursWithAbs(end CherryTime) int64
- func (c CherryTime) DiffInMinutes(end CherryTime) int64
- func (c CherryTime) DiffInMinutesWithAbs(end CherryTime) int64
- func (c CherryTime) DiffInMonths(end CherryTime) int64
- func (c CherryTime) DiffInMonthsWithAbs(end CherryTime) int64
- func (c CherryTime) DiffInSeconds(end CherryTime) int64
- func (c CherryTime) DiffInSecondsWithAbs(end CherryTime) int64
- func (c CherryTime) DiffInWeeks(end CherryTime) int64
- func (c CherryTime) DiffInWeeksWithAbs(end CherryTime) int64
- func (c CherryTime) DiffInYears(end CherryTime) int64
- func (c CherryTime) DiffInYearsWithAbs(end CherryTime) int64
- func (c CherryTime) EndOfDay() time.Time
- func (c CherryTime) EndOfHour() time.Time
- func (c CherryTime) EndOfMinute() time.Time
- func (c CherryTime) EndOfMonth() time.Time
- func (c CherryTime) EndOfSecond() time.Time
- func (c CherryTime) EndOfWeek() time.Time
- func (c CherryTime) EndOfYear() time.Time
- func (c CherryTime) Hour() int
- func (c CherryTime) IsApril() bool
- func (c CherryTime) IsAugust() bool
- func (c CherryTime) IsDecember() bool
- func (c CherryTime) IsFebruary() bool
- func (c CherryTime) IsFriday() bool
- func (c CherryTime) IsFuture() bool
- func (c CherryTime) IsJanuary() bool
- func (c CherryTime) IsJuly() bool
- func (c CherryTime) IsJune() bool
- func (c CherryTime) IsLeapYear() bool
- func (c CherryTime) IsLongYear() bool
- func (c CherryTime) IsMarch() bool
- func (c CherryTime) IsMay() bool
- func (c CherryTime) IsMonday() bool
- func (c CherryTime) IsNovember() bool
- func (c CherryTime) IsNow() bool
- func (c CherryTime) IsOctober() bool
- func (c CherryTime) IsPast() bool
- func (c CherryTime) IsSaturday() bool
- func (c CherryTime) IsSeptember() bool
- func (c CherryTime) IsSunday() bool
- func (c CherryTime) IsThursday() bool
- func (c CherryTime) IsToday() bool
- func (c CherryTime) IsTomorrow() bool
- func (c CherryTime) IsTuesday() bool
- func (c CherryTime) IsWednesday() bool
- func (c CherryTime) IsWeekday() bool
- func (c CherryTime) IsWeekend() bool
- func (c CherryTime) IsYesterday() bool
- func (c CherryTime) Microsecond() int
- func (c CherryTime) Millisecond() int
- func (c CherryTime) Minute() int
- func (c CherryTime) Month() int
- func (c CherryTime) MonthOfYear() int
- func (c CherryTime) Nanosecond() int
- func (c CherryTime) Quarter() int
- func (c CherryTime) Second() int
- func (c *CherryTime) SetDay(day int)
- func (c *CherryTime) SetHour(hour int)
- func (c *CherryTime) SetMinute(minute int)
- func (c *CherryTime) SetMonth(month int)
- func (c *CherryTime) SetSecond(second int)
- func (c *CherryTime) SetTimezone(timezone string) error
- func (c *CherryTime) SetYear(year int)
- func (c CherryTime) StartOfDay() time.Time
- func (c CherryTime) StartOfHour() time.Time
- func (c CherryTime) StartOfMinute() time.Time
- func (c CherryTime) StartOfMonth() time.Time
- func (c CherryTime) StartOfSecond() time.Time
- func (c CherryTime) StartOfWeek() time.Time
- func (c CherryTime) StartOfYear() time.Time
- func (c *CherryTime) SubCenturies(centuries int)
- func (c *CherryTime) SubCenturiesNoOverflow(centuries int)
- func (c *CherryTime) SubCentury()
- func (c *CherryTime) SubCenturyNoOverflow()
- func (c *CherryTime) SubDay()
- func (c *CherryTime) SubDays(days int)
- func (c *CherryTime) SubDuration(duration string) error
- func (c *CherryTime) SubHour()
- func (c *CherryTime) SubHours(hours int)
- func (c *CherryTime) SubMinute()
- func (c *CherryTime) SubMinutes(minutes int)
- func (c *CherryTime) SubMonth()
- func (c *CherryTime) SubMonthNoOverflow()
- func (c *CherryTime) SubMonths(months int)
- func (c *CherryTime) SubMonthsNoOverflow(months int)
- func (c *CherryTime) SubQuarter()
- func (c *CherryTime) SubQuarterNoOverflow()
- func (c *CherryTime) SubQuarters(quarters int)
- func (c *CherryTime) SubQuartersNoOverflow(quarters int)
- func (c *CherryTime) SubSecond()
- func (c *CherryTime) SubSeconds(seconds int)
- func (c *CherryTime) SubWeek()
- func (c *CherryTime) SubWeeks(weeks int)
- func (c *CherryTime) SubYear()
- func (c *CherryTime) SubYearNoOverflow()
- func (c *CherryTime) SubYears(years int)
- func (c *CherryTime) SubYearsNoOverflow(years int)
- func (c CherryTime) Timezone() string
- func (c CherryTime) ToDateFormat() string
- func (c CherryTime) ToDateTimeFormat() string
- func (c CherryTime) ToMillisecond() int64
- func (c CherryTime) ToShortDateFormat() string
- func (c CherryTime) ToShortDateTimeFormat() string
- func (c CherryTime) ToShortTimeFormat() string
- func (c CherryTime) ToTimeFormat() string
- func (c CherryTime) ToTimestamp() int64
- func (c CherryTime) ToTimestampWithMicrosecond() int64
- func (c CherryTime) ToTimestampWithMillisecond() int64
- func (c CherryTime) ToTimestampWithNanosecond() int64
- func (c CherryTime) ToTimestampWithSecond() int64
- func (c CherryTime) Week() int
- func (c CherryTime) WeekOfMonth() int
- func (c CherryTime) WeekOfYear() int
- func (c CherryTime) 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毫秒 MicrosecondsPerMillisecond = 1000 // 每毫秒1000微秒 MicrosecondsPerSecond = 1000000 // 每秒1000000微秒 WeeksPerLongYear = 53 // 每长年53周 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 AddGlobalOffset ¶
func AddGlobalOffset(second int)
func ParseByDuration ¶
ParseByDuration 通过持续时间解析
func SetGlobalLocation ¶
func SubGlobalOffset ¶
func SubGlobalOffset(second int)
Types ¶
type CherryTime ¶
func CreateFromDate ¶
func CreateFromDate(year int, month int, day int) CherryTime
CreateFromDate 从年月日创建 Carbon 实例(默认时区)
func CreateFromDateTime ¶
CreateFromDateTime 从年月日时分秒创建 Carbon 实例
func CreateFromTime ¶
func CreateFromTime(hour int, minute int, second int) CherryTime
CreateFromTime 从时分秒创建 Carbon 实例(默认时区)
func CreateFromTimestamp ¶
func CreateFromTimestamp(timestamp int64) CherryTime
CreateFromTimestamp 从时间戳创建 Carbon 实例
func Now ¶
func Now() CherryTime
func Tomorrow ¶
func Tomorrow() CherryTime
func Yesterday ¶
func Yesterday() CherryTime
func (*CherryTime) AddCenturies ¶
func (c *CherryTime) AddCenturies(centuries int)
AddCenturies N世纪后
func (*CherryTime) AddCenturiesNoOverflow ¶
func (c *CherryTime) AddCenturiesNoOverflow(centuries int)
AddCenturiesNoOverflow N世纪后(月份不溢出)
func (*CherryTime) AddCenturyNoOverflow ¶
func (c *CherryTime) AddCenturyNoOverflow()
AddCenturyNoOverflow 1世纪后(月份不溢出)
func (*CherryTime) AddDuration ¶
func (c *CherryTime) AddDuration(duration string) error
AddDuration 按照持续时间字符串增加时间 支持整数/浮点数和符号ns(纳秒)、us(微妙)、ms(毫秒)、s(秒)、m(分钟)、h(小时)的组合
func (*CherryTime) AddMonthNoOverflow ¶
func (c *CherryTime) AddMonthNoOverflow()
AddMonthNoOverflow 1月后(月份不溢出)
func (*CherryTime) AddMonthsNoOverflow ¶
func (c *CherryTime) AddMonthsNoOverflow(months int)
AddMonthsNoOverflow N月后(月份不溢出)
func (*CherryTime) AddQuarterNoOverflow ¶
func (c *CherryTime) AddQuarterNoOverflow()
AddQuarterNoOverflow 1季度后(月份不溢出)
func (*CherryTime) AddQuartersNoOverflow ¶
func (c *CherryTime) AddQuartersNoOverflow(quarters int)
AddQuartersNoOverflow N季度后(月份不溢出)
func (*CherryTime) AddYearNoOverflow ¶
func (c *CherryTime) AddYearNoOverflow()
AddYearNoOverflow 1年后(月份不溢出)
func (*CherryTime) AddYearsNoOverflow ¶
func (c *CherryTime) AddYearsNoOverflow(years int)
AddYearsNoOverflow N年后(月份不溢出)
func (CherryTime) DiffInDays ¶
func (c CherryTime) DiffInDays(end CherryTime) int64
DiffInDays 相差多少天
func (CherryTime) DiffInDaysWithAbs ¶
func (c CherryTime) DiffInDaysWithAbs(end CherryTime) int64
DiffInDaysWithAbs 相差多少天(绝对值)
func (CherryTime) DiffInHours ¶
func (c CherryTime) DiffInHours(end CherryTime) int64
DiffInHours 相差多少小时
func (CherryTime) DiffInHoursWithAbs ¶
func (c CherryTime) DiffInHoursWithAbs(end CherryTime) int64
DiffInHoursWithAbs 相差多少小时(绝对值)
func (CherryTime) DiffInMinutes ¶
func (c CherryTime) DiffInMinutes(end CherryTime) int64
DiffInMinutes 相差多少分钟
func (CherryTime) DiffInMinutesWithAbs ¶
func (c CherryTime) DiffInMinutesWithAbs(end CherryTime) int64
DiffInMinutesWithAbs 相差多少分钟(绝对值)
func (CherryTime) DiffInMonths ¶
func (c CherryTime) DiffInMonths(end CherryTime) int64
DiffInMonths 相差多少月
func (CherryTime) DiffInMonthsWithAbs ¶
func (c CherryTime) DiffInMonthsWithAbs(end CherryTime) int64
DiffInMonthsWithAbs 相差多少月(绝对值)
func (CherryTime) DiffInSeconds ¶
func (c CherryTime) DiffInSeconds(end CherryTime) int64
DiffInSeconds 相差多少秒
func (CherryTime) DiffInSecondsWithAbs ¶
func (c CherryTime) DiffInSecondsWithAbs(end CherryTime) int64
DiffInSecondsWithAbs 相差多少秒(绝对值)
func (CherryTime) DiffInWeeks ¶
func (c CherryTime) DiffInWeeks(end CherryTime) int64
DiffInWeeks 相差多少周
func (CherryTime) DiffInWeeksWithAbs ¶
func (c CherryTime) DiffInWeeksWithAbs(end CherryTime) int64
DiffInWeeksWithAbs 相差多少周(绝对值)
func (CherryTime) DiffInYears ¶
func (c CherryTime) DiffInYears(end CherryTime) int64
DiffInYears 相差多少年
func (CherryTime) DiffInYearsWithAbs ¶
func (c CherryTime) DiffInYearsWithAbs(end CherryTime) int64
DiffInYearsWithAbs 相差多少年(绝对值)
func (*CherryTime) SetTimezone ¶
func (c *CherryTime) SetTimezone(timezone string) error
func (CherryTime) StartOfMinute ¶
func (c CherryTime) StartOfMinute() time.Time
StartOfMinute 分钟开始时间
func (*CherryTime) SubCenturies ¶
func (c *CherryTime) SubCenturies(centuries int)
SubCenturies N世纪前
func (*CherryTime) SubCenturiesNoOverflow ¶
func (c *CherryTime) SubCenturiesNoOverflow(centuries int)
SubCenturiesNoOverflow N世纪前(月份不溢出)
func (*CherryTime) SubCenturyNoOverflow ¶
func (c *CherryTime) SubCenturyNoOverflow()
SubCenturyNoOverflow 1世纪前(月份不溢出)
func (*CherryTime) SubDuration ¶
func (c *CherryTime) SubDuration(duration string) error
SubDuration 按照持续时间字符串减少时间 支持整数/浮点数和符号ns(纳秒)、us(微妙)、ms(毫秒)、s(秒)、m(分钟)、h(小时)的组合
func (*CherryTime) SubMonthNoOverflow ¶
func (c *CherryTime) SubMonthNoOverflow()
SubMonthNoOverflow 1月前(月份不溢出)
func (*CherryTime) SubMonthsNoOverflow ¶
func (c *CherryTime) SubMonthsNoOverflow(months int)
SubMonthsNoOverflow N月前(月份不溢出)
func (*CherryTime) SubQuarterNoOverflow ¶
func (c *CherryTime) SubQuarterNoOverflow()
SubQuarterNoOverflow 1季度前(月份不溢出)
func (*CherryTime) SubQuartersNoOverflow ¶
func (c *CherryTime) SubQuartersNoOverflow(quarters int)
SubQuartersNoOverflow N季度前(月份不溢出)
func (*CherryTime) SubYearNoOverflow ¶
func (c *CherryTime) SubYearNoOverflow()
SubYearNoOverflow 1年前(月份不溢出)
func (*CherryTime) SubYearsNoOverflow ¶
func (c *CherryTime) SubYearsNoOverflow(years int)
SubYearsNoOverflow N年前(月份不溢出)
func (CherryTime) ToDateTimeFormat ¶
func (c CherryTime) ToDateTimeFormat() string
ToDateTimeFormat 2006-01-02 15:04:05
func (CherryTime) ToMillisecond ¶
func (c CherryTime) ToMillisecond() int64
func (CherryTime) ToShortDateFormat ¶
func (c CherryTime) ToShortDateFormat() string
ToShortDateFormat 20060102
func (CherryTime) ToShortDateTimeFormat ¶
func (c CherryTime) ToShortDateTimeFormat() string
ToShortDateTimeFormat 20060102150405
func (CherryTime) ToShortTimeFormat ¶
func (c CherryTime) ToShortTimeFormat() string
ToShortTimeFormat 150405
func (CherryTime) ToTimestamp ¶
func (c CherryTime) ToTimestamp() int64
ToTimestamp ToTimestampWithSecond的简称
func (CherryTime) ToTimestampWithMicrosecond ¶
func (c CherryTime) ToTimestampWithMicrosecond() int64
ToTimestampWithMicrosecond 输出微秒级时间戳
func (CherryTime) ToTimestampWithMillisecond ¶
func (c CherryTime) ToTimestampWithMillisecond() int64
ToTimestampWithMillisecond 输出毫秒级时间戳
func (CherryTime) ToTimestampWithNanosecond ¶
func (c CherryTime) ToTimestampWithNanosecond() int64
ToTimestampWithNanosecond 输出纳秒级时间戳
func (CherryTime) ToTimestampWithSecond ¶
func (c CherryTime) ToTimestampWithSecond() int64
ToTimestampWithSecond 输出秒级时间戳