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 Formatter
- type Time
- func Date(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) Time
- func FirstDayOfMonth(year int, month time.Month) Time
- func FirstDayOfWeek(year int, month time.Month, day int) Time
- func FirstDayOfYear(year int) Time
- func FromMicrosecond(ms int64) Time
- func FromMillisecond(ms int64) Time
- func FromNanosecond(ns int64) Time
- func FromSecond(s int64) Time
- func FromTime(t time.Time) Time
- func LastDayOfMonth(year int, month time.Month) Time
- func LastDayOfWeek(year int, month time.Month, day int) Time
- func LastDayOfYear(year 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 (t Time) Add(d time.Duration) Time
- func (t Time) AddDate(years int, months int, days int) Time
- func (t Time) After(u Time) bool
- func (t Time) Before(u Time) bool
- func (t Time) Compare(u Time) int
- func (t Time) End() Time
- func (t Time) Equal(u Time) bool
- func (t Time) FirstDayOfMonth() Time
- func (t Time) FirstDayOfWeek() Time
- func (t Time) FirstDayOfYear() Time
- func (t Time) Format(layout string) string
- func (t *Time) GobDecode(data []byte) error
- func (t Time) GobEncode() ([]byte, error)
- func (t Time) In(loc *time.Location) Time
- func (t Time) LastDayOfMonth() Time
- func (t Time) LastDayOfWeek() Time
- func (t Time) LastDayOfYear() Time
- func (t Time) Local() Time
- func (t Time) MarshalBinary() ([]byte, error)
- func (t Time) MarshalJSON() ([]byte, error)
- func (t Time) MarshalText() ([]byte, error)
- func (t Time) Next() Time
- func (t Time) Previous() Time
- func (t Time) Round(d time.Duration) Time
- func (t *Time) Scan(value interface{}) (err error)
- func (t Time) Start() Time
- func (t Time) Sub(u Time) time.Duration
- func (t Time) TrimHour() Time
- func (t Time) TrimMinute() Time
- func (t Time) TrimSecond() Time
- func (t Time) Truncate(d time.Duration) Time
- func (t Time) UTC() Time
- func (t Time) UnixMicrosecond() int64
- func (t Time) UnixMillisecond() int64
- func (t Time) UnixNanosecond() int64
- func (t Time) UnixSecond() int64
- func (t *Time) UnmarshalBinary(data []byte) error
- func (t *Time) UnmarshalJSON(data []byte) error
- func (t *Time) UnmarshalText(data []byte) error
- func (t Time) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var Local = time.Local
View Source
var UTC = time.UTC
Functions ¶
func MustLocation ¶
func NumberOfDaysInMonth ¶
NumberOfDaysInMonth 获取指定月份有多少天
Types ¶
type DefaultFormatter ¶
type DefaultFormatter struct {
Layout string
}
type Formatter ¶ added in v1.0.6
type Formatter interface {
Format(t time.Time) ([]byte, error)
Parse(data []byte) (time.Time, error)
}
var (
JSONFormatter Formatter = DefaultFormatter{time.RFC3339}
)
type Time ¶
func FirstDayOfMonth ¶ added in v1.0.6
FirstDayOfMonth 获取指定月份的第一天
func FirstDayOfWeek ¶ added in v1.0.6
FirstDayOfWeek 获取指定日期所在周的第一天
func FromMicrosecond ¶
func FromMillisecond ¶
func FromNanosecond ¶
func FromSecond ¶
func LastDayOfMonth ¶ added in v1.0.6
LastDayOfMonth 获取指定月份的最后一天
func LastDayOfWeek ¶ added in v1.0.6
LastDayOfWeek 获取指定日期所有周的最后一天
func (Time) FirstDayOfMonth ¶ added in v1.0.6
FirstDayOfMonth 获取当前日期所在月的第一天
func (Time) FirstDayOfWeek ¶ added in v1.0.6
FirstDayOfWeek 获取当前日期所在周的第一天
func (Time) FirstDayOfYear ¶ added in v1.0.6
FirstDayOfYear 获取当前日期所在年的第一天
func (Time) LastDayOfMonth ¶ added in v1.0.6
LastDayOfMonth 获取当前日期所在月的最后一天
func (Time) LastDayOfWeek ¶ added in v1.0.6
LastDayOfWeek 获取当前日期所在周的最后一天
func (Time) LastDayOfYear ¶ added in v1.0.6
LastDayOfYear 获取当前日期所在年的最后一天
func (Time) MarshalBinary ¶
func (Time) MarshalJSON ¶
func (Time) MarshalText ¶
func (Time) TrimMinute ¶ added in v1.0.4
TrimMinute 将 Minute 及以下的单位清除,只保留 Hour 及以上的信息
func (Time) TrimSecond ¶ added in v1.0.4
TrimSecond 将 Second 及以下的单位清除,只保留 Minute 及以上的信息
func (*Time) UnmarshalBinary ¶
func (*Time) UnmarshalJSON ¶
func (*Time) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.