datetime

package
v0.0.0-...-8587cce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultFormat  = "2006-01-02 15:04:05"
	CompressFormat = "20060102150405"
)

Variables

View Source
var (
	/** 设置每周的起始时间 */
	WeekStartDay = time.Sunday
)

Functions

func BeginThisMonth

func BeginThisMonth() time.Time

返回本月的第一刻

func BeginThisWeek

func BeginThisWeek() time.Time

返回本周的第一刻

func BeginThisYear

func BeginThisYear() time.Time

返回本年的第一刻

func CurrentCompress

func CurrentCompress() string

获取当前时间字符串 - yyyyMMddHHmmss

func CurrentHour

func CurrentHour() time.Time

当前小时

func CurrentMinute

func CurrentMinute() time.Time

当前分钟

func CurrentSecond

func CurrentSecond() time.Time

当前秒

func EndThisMonth

func EndThisMonth() time.Time

返回本月最后一刻

func EndThisWeek

func EndThisWeek() time.Time

返回本周最后一刻

func EndThisYear

func EndThisYear() time.Time

返回本年的最后一刻

func Parse

func Parse(str string) (t time.Time, err error)

字符串转时间

func String

func String(time DateTime) string

func Today

func Today() time.Time

返回今天的日期

func TodayEndMoment

func TodayEndMoment() time.Time

返回今天的最后一刻

Types

type DateTime

type DateTime struct {
	time.Time
}

DateTime 结构体

func (*DateTime) CurrentDefault

func (t *DateTime) CurrentDefault() string

获取当前时间字符串 - yyyy-MM-dd HH:mm:ss

func (*DateTime) CurrentTime

func (t *DateTime) CurrentTime() time.Time

func (DateTime) MarshalJSON

func (t DateTime) MarshalJSON() ([]byte, error)

func (DateTime) MarshalJSONSecond

func (t DateTime) MarshalJSONSecond() ([]byte, error)

func (*DateTime) Scan

func (t *DateTime) Scan(v interface{}) error

func (DateTime) Value

func (t DateTime) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL