datetime

package
v0.0.0-...-b1f09d4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Y_M                 = "2006-01"
	Y_M_D               = "2006-01-02"
	Y_M_D_2             = "2006年01月02日"
	Y_M_D_H_I_S         = "2006-01-02 15:04:05"
	Y_M_D_H_I_S_CST     = "2006-01-02 15:04:05 +0800 CST" //2016-12-04 15:39:06 +0800 CST
	Y_M_D_H_I_S_RFC3339 = "2006-01-02T15:04:05Z07:00"
	Y_M_D_H_I_S_2       = "2006年01月02日 15:04:05"
	H_I_S               = "15:04:05"
)

Variables

This section is empty.

Functions

func Date

func Date() string

当前日期

func Format

func Format(str interface{}, layout string) string

格式

func FormatTimeStruct

func FormatTimeStruct(str interface{}, layout string) (time.Time, error)

格式

func FormatTimeStructLocation

func FormatTimeStructLocation(str interface{}, layout string) (time.Time, error)

格式

func GetDaysInYear

func GetDaysInYear(t string) int

指定日期是年中的第几天

func GetDaysInYearByThisYear

func GetDaysInYearByThisYear() int

年中的第几天

func ISOWeekStart

func ISOWeekStart(t time.Time) time.Time

func Now

func Now() string

当前日期时间

func NowHourMinSec

func NowHourMinSec() (hour, min, sec int)

当前时分秒

func NowYearMonthDay

func NowYearMonthDay() (year int, month time.Month, day int)

当前年月日

func Time

func Time() string

当前时间

func TimeFormatByYmdHms

func TimeFormatByYmdHms(year int, month time.Month, day, hour, min, sec int) time.Time

时间格式化

func UnixTime

func UnixTime() int64

Unix时间戳

func UnixTimeFormat

func UnixTimeFormat(i int64, str string) string

func UnixTimeFormatDateTime

func UnixTimeFormatDateTime(i int64) string

func Weekday

func Weekday() string

输出当前日期是星期几

func YearMonth

func YearMonth() string

当前年月

Types

type DateTime

type DateTime time.Time

func (DateTime) Date

func (t DateTime) Date() string

日期

func (DateTime) DateTime

func (t DateTime) DateTime() string

日期时间

func (DateTime) Format

func (t DateTime) Format(layout string) string

func (DateTime) MarshalJSON

func (t DateTime) MarshalJSON() ([]byte, error)

func (DateTime) Time

func (t DateTime) Time() string

时间

Jump to

Keyboard shortcuts

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