time

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DateFormat      = "2006-01-02"
	TimeFormat      = "15:04:05"
	DateTimeFormat  = "2006-01-02 15:04:05"
	DateTime2Format = "20060102150405"
)

Functions

func SetTimezone

func SetTimezone(tz string)

设置时区

Types

type Time

type Time struct {
	// contains filtered or unexported fields
}

时间格式化

func FromTime

func FromTime(t time.Time) Time

来源时间

func FromTimestamp

func FromTimestamp(timestamp int64) Time

来源时间

func Now

func Now() Time

当前时间

func Parse

func Parse(str string) Time

解析时间

func (Time) Add

func (this Time) Add(t time.Duration) Time

添加

func (Time) AddString

func (this Time) AddString(str string) Time

添加字符时间

func (Time) ToDateString

func (this Time) ToDateString() string

输出格式化时间

func (Time) ToDateTime2String

func (this Time) ToDateTime2String() string

输出格式化时间

func (Time) ToDateTimeString

func (this Time) ToDateTimeString() string

输出格式化时间

func (Time) ToFormatString

func (this Time) ToFormatString(format string) string

输出格式化

func (Time) ToTime

func (this Time) ToTime() time.Time

输出时间

func (Time) ToTimeString

func (this Time) ToTimeString() string

输出格式化时间

func (Time) ToTimestamp

func (this Time) ToTimestamp() int64

输出格式化时间

func (Time) WithTime

func (this Time) WithTime(t time.Time) Time

设置时间

Jump to

Keyboard shortcuts

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