date

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeFormat         = "2006-01-02 15:04:05"
	TimeFormatYYYYMMDD = "20060102"
	TimeFormatUTC      = "2006-01-02T15:04:05Z"
)

Variables

View Source
var TimeFormatMap = map[string]string{
	"Y": "2006",
	"n": "1",
	"m": "01",
	"j": "2",
	"d": "02",
	"H": "15",
	"i": "04",
	"s": "05",
	"J": "05.000",
	"Q": "05.000000",
	"K": "05.000000000",
}

用来格式化时间

Functions

func Date

func Date(format string, timestamp ...int64) string

*

  • Date("Y-m-d H:i:s",1588149134)
  • @param
  • @return *

func Now

func Now() string

func StrToTime

func StrToTime(datetime string, format string) time.Time

StrToTime("2020-04-29 16:32:14",date.TimeFormat) Return Local Location Time

func StrToTimestamp

func StrToTimestamp(datetime string, format string) int64

StrToTimestamp("2020-04-29 16:32:14",date.TimeFormat)

Types

This section is empty.

Jump to

Keyboard shortcuts

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