timepkg

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RFC3339           = time.RFC3339               // 例子:2022-08-03T16:40:58+08:00
	YmdHmsTZ          = "2006-01-02T15:04:05-0700" // 例子:2022-08-03T16:40:58+0800
	YmdHms            = "2006-01-02 15:04:05"
	YmdHm             = "2006-01-02 15:04"
	YmdH              = "2006-01-02 15"
	Ymd               = "2006-01-02"
	Ym                = "2006-01"
	YSecond           = "20060102150405"
	YDay              = "20060102"
	MDay              = "0102"
	YmdHmsMillisecond = "2006-01-02 15:04:05.999"
	YmdHmsMicrosecond = "2006-01-02 15:04:05.999999"
	YmdHmsNanosecond  = "2006-01-02 15:04:05.999999999"
	YMillisecond      = "20060102150405.999"
	YMicrosecond      = "20060102150405.999999"
	YNanosecond       = "20060102150405.999999999"
	YmdHmsMLogger     = "2006-01-02T15:04:05.999"
)

Date Format

Variables

This section is empty.

Functions

func DateToTime

func DateToTime(format, date string) (time.Time, error)

DateToTime date to time

func FormatRFC3339

func FormatRFC3339(t time.Time) string

FormatRFC3339 to RFC3339

func ThisMonth

func ThisMonth(t time.Time) time.Time

ThisMonth 2019-08-21 22:07:07 -> 2019-08-01 00:00:00

func ThisYear

func ThisYear(t time.Time) time.Time

ThisYear 2019-08-21 22:07:07 -> 2019-01-01 00:00:00

func TimestampToDate

func TimestampToDate(u int64, format string) string

TimestampToDate timestamp to date

func TimestampToTime

func TimestampToTime(u int64) time.Time

TimestampToTime timestamp to Time

func ToDay

func ToDay(t time.Time) time.Time

ToDay 2019-08-21 22:07:07 -> 2019-08-21 00:00:00

func ToHour

func ToHour(t time.Time) time.Time

ToHour 2019-08-21 22:07:07 -> 2019-08-21 22:00:00

func ToMinute

func ToMinute(t time.Time) time.Time

ToMinute 2019-08-21 22:07:07 -> 2019-08-21 22:07:00

func Today

func Today() time.Time

Today 今天0时

Types

This section is empty.

Jump to

Keyboard shortcuts

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