xtime

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PFormatConv

func PFormatConv(pformat string) string

PFormatConv php Format 转go Format

Types

type XTime

type XTime struct {
	Time time.Time
}

XTime 2019-08-03 08:58:48.9967745 +0800 CST m=+0.040889401

func CustomTime

func CustomTime(time time.Time) *XTime

CustomTime 设置时间

func Date

func Date(day int, month int, year int) *XTime

Date 设置日期

func DateTime

func DateTime(day int, month int, year int, hour int, min int, sec int) *XTime

DateTime 设置日期和时间

func Now

func Now() *XTime

Now 当前时间

func Str2Time

func Str2Time(str string, _format ...string) *XTime

Str2Time 设置时间

func (*XTime) DateStr

func (k *XTime) DateStr() string

DateStr 返回 年-月-日

func (*XTime) DateTimeStr

func (k *XTime) DateTimeStr() string

DateTimeStr 返回 年-月-日 时:分:秒

func (*XTime) Format

func (k *XTime) Format(format string) string

Format go语言标准时间格式

func (*XTime) PFormat

func (k *XTime) PFormat(pformat string) string

PFormat 返回时间字符串

Custom formatters :

"F": Long Month,
"M": Month,
"m": Zero Number Month,
"n": Number Month,
"Y": Long Year,
"y": Year,
"l": Long Day,
"D": Day,
"d": Long Number Day,
"j": Number Day,
"H": Long Hour,
"G": Hour,
"i": Long Minute,
"s":  Long Second,

func (*XTime) TimeStr

func (k *XTime) TimeStr() string

TimeStr 返回 时:分:秒

func (*XTime) Unix

func (k *XTime) Unix() int64

Unix 时间戳(秒)

func (*XTime) UnixMilli

func (k *XTime) UnixMilli() int64

UnixNano 时间戳(毫秒)

func (*XTime) UnixNano

func (k *XTime) UnixNano() int64

fmt.Printf("时间戳(纳秒转换为秒):%v;\n",time.Now().UnixNano() / 1e9) UnixNano 时间戳(纳秒)

func (*XTime) Weekday

func (k *XTime) Weekday() int

Weekday 星期数字 (Sunday 星期日 = 0, ...).

func (*XTime) WeekdayStr

func (k *XTime) WeekdayStr(t ...int) string

WeekdayStr 星期字符串 0 = { "星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" }; 1 = { "周日", "周一", "周二", "周三", "周四", "周五", "周六" }; 2 = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; 3 = { "sun", "mon", "tue", "wed", "thu", "fri", "sat" };

Jump to

Keyboard shortcuts

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