datetime

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountDaysOfAMonth

func CountDaysOfAMonth(yearAndMonth string) (int, error)

Count Days Of A Month

func DateTime2TimeStamp

func DateTime2TimeStamp(format string, datetime string) int64

func DateTimeToTimeStamp

func DateTimeToTimeStamp(datetime string) int64

Date time to time stamp

func FormatPastTime

func FormatPastTime(pastTimeStamp int64) (int, string, string)

Calculate past time

func IsLeap

func IsLeap(year int) bool

func IsLeapYear

func IsLeapYear(year int) bool

Is Leap Year

func TimeStampToDatatime

func TimeStampToDatatime(timeStamp int64) string

Time stamp to date time

func TimeStampToDatatimeFormat

func TimeStampToDatatimeFormat(timeStamp int64, format string) string

Time stamp to date time and format

func TimeStampToDatatimeSlice

func TimeStampToDatatimeSlice(timeStamp int64) []string

Time stamp to slice [] string

Types

type DateTime

type DateTime struct {
	Year         int
	YearString   string
	Month        int
	MonthString  string
	Day          int
	DayString    string
	Hour         int
	HourString   string
	Minute       int
	MinuteString string
	Second       int
	SecondString string
	TimeStamp    int64
	Format       string
	Result       string
	Time         time.Time
}

func New

func New() *DateTime

func (*DateTime) CountDaysOfAMonth

func (st *DateTime) CountDaysOfAMonth(month int) int

获取某月天数

func (*DateTime) InitFromDatatime

func (dt *DateTime) InitFromDatatime(datetime string)

func (*DateTime) InitFromTimeStamp

func (dt *DateTime) InitFromTimeStamp(timeStamp int64)

func (*DateTime) IsLeap

func (dt *DateTime) IsLeap() bool

闰年

func (*DateTime) Now

func (dt *DateTime) Now()

当前时间

func (*DateTime) Swicth

func (dt *DateTime) Swicth(tp string, val int) *DateTime

切换时间

Jump to

Keyboard shortcuts

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