time

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 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"
)

Functions

func SetTimezone added in v1.0.1

func SetTimezone(tz string)

设置时区

Types

type Time

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

*

  • 时间格式化 *
  • @create 2023-1-3
  • @author deatil

func FromTime

func FromTime(t time.Time) Time

来源时间

func FromTimestamp

func FromTimestamp(timestamp int64) Time

来源时间

func MustParse

func MustParse(str string) Time

解析失败后抛出异常

func Now

func Now() Time

当前时间

func Parse

func Parse(str string) Time

解析

func (Time) ToDateString

func (this Time) ToDateString() 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) 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