Documentation
¶
Index ¶
- Variables
- func AppointStamp64(t time.Duration) (timestamp int64)
- func BeginningOfDay() time.Time
- func BeginningOfHour() time.Time
- func BeginningOfMinute() time.Time
- func BeginningOfMonth() time.Time
- func BeginningOfQuarter() time.Time
- func BeginningOfWeek() time.Time
- func BeginningOfYear() time.Time
- func Between(time1, time2 string) bool
- func EndOfDay() time.Time
- func EndOfHour() time.Time
- func EndOfMinute() time.Time
- func EndOfMonth() time.Time
- func EndOfQuarter() time.Time
- func EndOfSunday() time.Time
- func EndOfWeek() time.Time
- func EndOfYear() time.Time
- func Format(format string, ts ...time.Time) string
- func Int64ToString(t int64) string
- func Monday() time.Time
- func MustParse(strs ...string) time.Time
- func MustParseInLocation(loc *time.Location, strs ...string) time.Time
- func Parse(strs ...string) (time.Time, error)
- func ParseInLocation(loc *time.Location, strs ...string) (time.Time, error)
- func Stamp32() (timestamp int)
- func Stamp64() int64
- func StrToLocalTime(value string) time.Time
- func StrToTime(value string) time.Time
- func String(model string) string
- func Sunday() time.Time
- type Now
- func (now *Now) BeginningOfDay() time.Time
- func (now *Now) BeginningOfHour() time.Time
- func (now *Now) BeginningOfMinute() time.Time
- func (now *Now) BeginningOfMonth() time.Time
- func (now *Now) BeginningOfQuarter() time.Time
- func (now *Now) BeginningOfWeek() time.Time
- func (now *Now) BeginningOfYear() time.Time
- func (now *Now) Between(begin, end string) bool
- func (now *Now) EndOfDay() time.Time
- func (now *Now) EndOfHour() time.Time
- func (now *Now) EndOfMinute() time.Time
- func (now *Now) EndOfMonth() time.Time
- func (now *Now) EndOfQuarter() time.Time
- func (now *Now) EndOfSunday() time.Time
- func (now *Now) EndOfWeek() time.Time
- func (now *Now) EndOfYear() time.Time
- func (now *Now) Monday() time.Time
- func (now *Now) MustParse(strs ...string) (t time.Time)
- func (now *Now) Parse(strs ...string) (t time.Time, err error)
- func (now *Now) Sunday() time.Time
Constants ¶
This section is empty.
Variables ¶
var ( DefaultFormat = "2006-01-02 15:04:05" DayFormat = "2006-01-02" DayFormat1 = "2006/01/02" MonthFormat = "2006-01" TzFormat = "2006-01-02T15:04:05Z" TFormat = "2006-01-02T15:04:05+08:00" )
var TimeFormats = []string{"_1/2/2006", "_1/2/2006 15:4:5", "2006", "2006-_1", "2006-_1-2", "2006-_1-2 15", "2006-_1-2 15:4", "2006-_1-2 15:4:5", "_1-2", "15:4:5", "15:4", "15", "15:4:5 Jan 2, 2006 MST", "2006-01-02 15:04:05.999999999 -0700 MST", "2006-01-02T15:04:05-07:00"}
TimeFormats default time formats will be parsed as
var (
TimeTemplate map[string]string = map[string]string{
"timeTemplate1": "2006-01-02 15:04:05",
"timeTemplate2": "2006/01/02 15:04:05",
"timeTemplate3": "2006-01-02",
"timeTemplate4": "15:04:05",
}
)
var WeekStartDay = time.Monday
WeekStartDay set week start day, default is sunday
Functions ¶
func AppointStamp64 ¶
正确的使用方式 time.Sleep(time.Second * time.Duration(common.C.CpuTempRest)) 获取指定时间的时间戳 获取一个月之后的时间戳 30 * 24 * 60 * 60 * time.Second 或者 30 * 24 * time.Hour
func BeginningOfQuarter ¶
BeginningOfQuarter beginning of quarter
func Format ¶
* 抄的https://github.com/polaris1119/times
Format 跟 PHP 中 date 类似的使用方式,如果 ts 没传递,则使用当前时间
func MustParseInLocation ¶
MustParseInLocation must parse string to time in location or will panic
func ParseInLocation ¶
ParseInLocation parse string to time in location
func StrToLocalTime ¶
Types ¶
type Now ¶
Now now struct
func (*Now) BeginningOfDay ¶
BeginningOfDay beginning of day
func (*Now) BeginningOfHour ¶
BeginningOfHour beginning of hour
func (*Now) BeginningOfMinute ¶
BeginningOfMinute beginning of minute
func (*Now) BeginningOfMonth ¶
BeginningOfMonth beginning of month
func (*Now) BeginningOfQuarter ¶
BeginningOfQuarter beginning of quarter
func (*Now) BeginningOfWeek ¶
BeginningOfWeek beginning of week
func (*Now) BeginningOfYear ¶
BeginningOfYear BeginningOfYear beginning of year