Documentation
¶
Index ¶
- Variables
- func LoadLocation(name string) (*time.Location, error)
- func MustLocation(name string) *time.Location
- func NumberOfDaysInMonth(year int, month time.Month) (number int)
- func TimeZones() []string
- type DefaultFormatter
- type Time
- func BeginningDateOfMonth(year int, month time.Month) *Time
- func BeginningDateOfWeek(year int, month time.Month, day int) *Time
- func BeginningDateOfYear(year int) *Time
- func BeginningTime(t *Time) *Time
- func BeginningTimeOfDay(year int, month time.Month, day int) *Time
- func Date(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) *Time
- func EndDateOfMonth(year int, month time.Month) *Time
- func EndDateOfWeek(year int, month time.Month, day int) *Time
- func EndDateOfYear(year int) *Time
- func EndTime(t *Time) *Time
- func EndTimeOfDay(year int, month time.Month, day int) *Time
- func MustParse(layout, value string) *Time
- func MustParseInLocation(layout, value string, loc *time.Location) *Time
- func Now() *Time
- func Parse(layout, value string) (*Time, error)
- func ParseInLocation(layout, value string, loc *time.Location) (*Time, error)
- func Unix(sec int64, nsec int64) *Time
- func UnixIn(sec int64, nsec int64, loc *time.Location) *Time
- func WithMicrosecond(ms int64) *Time
- func WithMillisecond(ms int64) *Time
- func WithNanosecond(ns int64) *Time
- func WithSecond(s int64) *Time
- func WithTime(t time.Time) *Time
- func (this *Time) Add(d time.Duration) *Time
- func (this *Time) AddDate(years int, months int, days int) *Time
- func (this *Time) After(t *Time) bool
- func (this *Time) Before(t *Time) bool
- func (this *Time) BeginningDateOfMonth() *Time
- func (this *Time) BeginningDateOfWeek() *Time
- func (this *Time) BeginningTime() *Time
- func (this *Time) DiffDays(t *Time) int
- func (this *Time) EndDateOfMonth() *Time
- func (this *Time) EndDateOfWeek() *Time
- func (this *Time) EndTime() *Time
- func (this Time) Format(layout string) string
- func (this *Time) GobDecode(data []byte) error
- func (this Time) GobEncode() ([]byte, error)
- func (this *Time) GreaterThan(t *Time) bool
- func (this *Time) In(loc *time.Location) *Time
- func (this *Time) LessThan(t *Time) bool
- func (this *Time) Local() *Time
- func (this Time) MarshalBinary() ([]byte, error)
- func (this Time) MarshalJSON() ([]byte, error)
- func (this Time) MarshalText() ([]byte, error)
- func (this *Time) NextDate() *Time
- func (this *Time) PreviousDate() *Time
- func (this *Time) Scan(value interface{}) (err error)
- func (this *Time) Sub(t *Time) time.Duration
- func (this *Time) UTC() *Time
- func (this *Time) UnixMicrosecond() int64
- func (this *Time) UnixMillisecond() int64
- func (this *Time) UnixNanosecond() int64
- func (this *Time) UnixSecond() int64
- func (this *Time) UnmarshalBinary(data []byte) error
- func (this *Time) UnmarshalJSON(data []byte) error
- func (this *Time) UnmarshalText(data []byte) error
- func (this *Time) Value() (driver.Value, error)
- type TimeFormatter
Constants ¶
This section is empty.
Variables ¶
var Local = time.Local
var UTC = time.UTC
Functions ¶
func MustLocation ¶
func NumberOfDaysInMonth ¶
NumberOfDaysInMonth 获取指定月份有多少天
Types ¶
type DefaultFormatter ¶
type DefaultFormatter struct {
Layout string
}
--------------------------------------------------------------------------------
type Time ¶
--------------------------------------------------------------------------------
func BeginningDateOfMonth ¶
BeginningDateOfMonth 获取指定月份的第一天
func BeginningDateOfWeek ¶
BeginningDateOfWeek 获取指定日期所在周的第一天
func BeginningTimeOfDay ¶
BeginningTimeOfDay 获取指定日期的开始时间
func EndDateOfMonth ¶
EndDateOfMonth 获取指定月份的最后一天
func EndDateOfWeek ¶
EndDateOfWeek 获取指定日期所有周的最后一天
func EndTimeOfDay ¶
EndTimeOfDay 获取指定日期的结束时间
func ParseInLocation ¶
func WithMicrosecond ¶
func WithMillisecond ¶
func WithNanosecond ¶
func WithSecond ¶
func (*Time) BeginningDateOfMonth ¶
BeginningDateOfMonth 获取当前日期所在月的第一天
func (*Time) BeginningDateOfWeek ¶
BeginningDateOfWeek 获取当前日期所在周的第一天
func (*Time) BeginningTime ¶
func (*Time) DiffDays ¶
--------------------------------------------------------------------------------
func (*Time) EndDateOfMonth ¶
EndDateOfMonth 获取当前日期所在月的最后一天
func (*Time) GreaterThan ¶
--------------------------------------------------------------------------------
func (Time) MarshalBinary ¶
func (Time) MarshalJSON ¶
func (Time) MarshalText ¶
func (*Time) PreviousDate ¶
-------------------------------------------------------------------------------- PreviousDate 获取当前日期的前一天(昨天)
func (*Time) UnixNanosecond ¶
-------------------------------------------------------------------------------- Nanosecond 纳秒(ns)
func (*Time) UnmarshalBinary ¶
func (*Time) UnmarshalJSON ¶
func (*Time) UnmarshalText ¶
type TimeFormatter ¶
type TimeFormatter interface {
Format(t time.Time) ([]byte, error)
Parse(data []byte) (time.Time, error)
}
--------------------------------------------------------------------------------
var (
JSONFormatter TimeFormatter = DefaultFormatter{time.RFC3339}
)