Documentation ¶
Overview ¶
Package ztime provides time related operations
Index ¶
- Variables
- func FormatTime(t time.Time, format ...string) string
- func FormatTimestamp(timestamp int64, format ...string) string
- func FormatTlp(format string) string
- func GetTimeZone() *time.Location
- func MonthRange(year int, month int) (beginTime, endTime int64, err error)
- func Now(format ...string) string
- func Parse(str string, format ...string) (time.Time, error)
- func Unix(tt int64) time.Time
- func Week(t time.Time) int
- func Zone(zone ...int) *time.Location
- type TimeEngine
- func (e *TimeEngine) FormatTime(t time.Time, format ...string) string
- func (e *TimeEngine) FormatTimestamp(timestamp int64, format ...string) string
- func (e *TimeEngine) GetTimeZone() *time.Location
- func (e *TimeEngine) MonthRange(year int, month int) (beginTime, endTime int64, err error)
- func (e *TimeEngine) Parse(str string, format ...string) (t time.Time, err error)
- func (e *TimeEngine) SetTimeZone(zone int) *TimeEngine
- func (e *TimeEngine) Unix(tt int64) time.Time
- func (e *TimeEngine) Week(t time.Time) int
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TimeTpl = "2006-01-02 15:04:05" GetLocationName = func(zone int) string { switch zone { case 8: return "Asia/Shanghai" } return "UTC" } )
Functions ¶
func FormatTimestamp ¶
FormatTimestamp format timestamp
Types ¶
type TimeEngine ¶
type TimeEngine struct {
// contains filtered or unexported fields
}
func (*TimeEngine) FormatTime ¶
func (e *TimeEngine) FormatTime(t time.Time, format ...string) string
FormatTime string format of return time
func (*TimeEngine) FormatTimestamp ¶
func (e *TimeEngine) FormatTimestamp(timestamp int64, format ...string) string
FormatTimestamp convert UNIX time to time string
func (*TimeEngine) GetTimeZone ¶
func (e *TimeEngine) GetTimeZone() *time.Location
GetTimeZone GetTimeZone
func (*TimeEngine) MonthRange ¶
func (e *TimeEngine) MonthRange(year int, month int) (beginTime, endTime int64, err error)
MonthRange gets the start and end UNIX times for the specified year and month
func (*TimeEngine) SetTimeZone ¶
func (e *TimeEngine) SetTimeZone(zone int) *TimeEngine
SetTimeZone SetTimeZone
Click to show internal directories.
Click to hide internal directories.