gotime

package
v1.0.46-0...-d927801 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RFC3339Format       = time.RFC3339
	Iso8601Format       = "2006-01-02T15:04:05-07:00"
	CookieFormat        = "Monday, 02-Jan-2006 15:04:05 MST"
	RFC1036Format       = "Mon, 02 Jan 06 15:04:05 -0700"
	RFC7231Format       = "Mon, 02 Jan 2006 15:04:05 GMT"
	DayDateTimeFormat   = "Mon, Jan 2, 2006 3:04 PM"
	DateTimeFormat      = "2006-01-02 15:04:05"
	DateFormat          = "2006-01-02"
	TimeFormat          = "15:04:05"
	ShortDateTimeFormat = "20060102150405"
	ShortDateFormat     = "20060102"
	ShortTimeFormat     = "150405"
)

时间格式化常量

View Source
const (
	YearsPerMillennium = 1000 // 每千年1000年
	YearsPerCentury    = 100  // 每世纪100年
	YearsPerDecade     = 10   // 每十年10年
	QuartersPerYear    = 4    // 每年4季度
	MonthsPerYear      = 12   // 每年12月
	MonthsPerQuarter   = 3    // 每季度3月
	WeeksPerNormalYear = 52   // 每常规年52周

	WeeksPerMonth              = 4       // 每月4周
	DaysPerLeapYear            = 366     // 每闰年366天
	DaysPerNormalYear          = 365     // 每常规年365天
	DaysPerWeek                = 7       // 每周7天
	HoursPerWeek               = 168     // 每周168小时
	HoursPerDay                = 24      // 每天24小时
	MinutesPerDay              = 1440    // 每天1440分钟
	MinutesPerHour             = 60      // 每小时60分钟
	SecondsPerWeek             = 604800  // 每周604800秒
	SecondsPerDay              = 86400   // 每天86400秒
	SecondsPerHour             = 3600    // 每小时3600秒
	SecondsPerMinute           = 60      // 每分钟60秒
	MillisecondsPerSecond      = 1000    // 每秒1000毫秒
	MicrosecondsPerMillisecond = 1000    // 每毫秒1000微秒
	MicrosecondsPerSecond      = 1000000 // 每秒1000000微秒
)

数字常量

Variables

This section is empty.

Functions

This section is empty.

Types

type Pro

type Pro struct {
	Time time.Time

	Error error
	// contains filtered or unexported fields
}

Pro 结构体

func Current

func Current() Pro

Current 获取当前的时间

func NewPro

func NewPro() Pro

NewPro 初始化结构体

func SetCurrent

func SetCurrent(sTime time.Time) Pro

SetCurrent 设置当前的时间

func SetCurrentParse

func SetCurrentParse(str string) Pro

SetCurrentParse 设置当前的时间

func SetCurrentUnix

func SetCurrentUnix(ts int64) Pro

SetCurrentUnix 设置当前的时间 Unix时间戳

func Tomorrow

func Tomorrow() Pro

Tomorrow 明天

func Yesterday

func Yesterday() Pro

Yesterday 昨天

func (Pro) AfterDay

func (p Pro) AfterDay(day int) Pro

AfterDay 获取n天后的时间

func (Pro) AfterHour

func (p Pro) AfterHour(hour int) Pro

AfterHour 获取n小时后的时间

func (Pro) AfterSeconds

func (p Pro) AfterSeconds(seconds int) Pro

AfterSeconds 获取n秒后的时间

func (Pro) BeforeDay

func (p Pro) BeforeDay(day int) Pro

BeforeDay 获取n天前的时间

func (Pro) BeforeHour

func (p Pro) BeforeHour(hour int) Pro

BeforeHour 获取n小时前的时间

func (Pro) BeforeSeconds

func (p Pro) BeforeSeconds(seconds int) Pro

BeforeSeconds 获取n秒前的时间

func (Pro) DiffInHour

func (p Pro) DiffInHour(t2 time.Time) (hour int64)

DiffInHour 相差多少小时

func (Pro) DiffInHourWithAbs

func (p Pro) DiffInHourWithAbs(t2 time.Time) (hour int64)

DiffInHourWithAbs 相差多少小时(绝对值)

func (Pro) DiffInMinutes

func (p Pro) DiffInMinutes(t2 time.Time) (hour int64)

DiffInMinutes 相差多少分钟

func (Pro) DiffInMinutesWithAbs

func (p Pro) DiffInMinutesWithAbs(t2 time.Time) (hour int64)

DiffInMinutesWithAbs 相差多少分钟(绝对值)

func (Pro) DiffInSecond

func (p Pro) DiffInSecond(t2 time.Time) (hour int64)

DiffInSecond 相差多少秒

func (Pro) DiffInSecondWithAbs

func (p Pro) DiffInSecondWithAbs(t2 time.Time) (hour int64)

DiffInSecondWithAbs 相差多少秒(绝对值)

func (Pro) EndOfCentury

func (p Pro) EndOfCentury() Pro

EndOfCentury 本世纪结束时间

func (Pro) EndOfDay

func (p Pro) EndOfDay() Pro

EndOfDay 本日结束时间

func (Pro) EndOfDecade

func (p Pro) EndOfDecade() Pro

EndOfDecade 本年代结束时间

func (Pro) EndOfMonth

func (p Pro) EndOfMonth() Pro

EndOfMonth 本月结束时间

func (Pro) EndOfQuarter

func (p Pro) EndOfQuarter() Pro

EndOfQuarter 本季度结束时间

func (Pro) EndOfYear

func (p Pro) EndOfYear() Pro

EndOfYear 本年结束时间

func (Pro) Format

func (p Pro) Format() string

Format 今天此刻格式化

func (Pro) Month

func (p Pro) Month() int

Month 获取当前月

func (Pro) MonthOfYear

func (p Pro) MonthOfYear() int

MonthOfYear 获取本年的第几月

func (Pro) Now

func (p Pro) Now() time.Time

Now 今天此刻

func (Pro) Quarter

func (p Pro) Quarter() (quarter int)

Quarter 获取当前季度

func (Pro) SetFormat

func (p Pro) SetFormat(layout string) string

SetFormat 格式化

func (Pro) StartOfCentury

func (p Pro) StartOfCentury() Pro

StartOfCentury 本世纪开始时间

func (Pro) StartOfDay

func (p Pro) StartOfDay() Pro

StartOfDay 本日开始时间

func (Pro) StartOfDecade

func (p Pro) StartOfDecade() Pro

StartOfDecade 本年代开始时间

func (Pro) StartOfMonth

func (p Pro) StartOfMonth() Pro

StartOfMonth 本月开始时间

func (Pro) StartOfQuarter

func (p Pro) StartOfQuarter() Pro

StartOfQuarter 本季度开始时间

func (Pro) StartOfYear

func (p Pro) StartOfYear() Pro

StartOfYear 本年开始时间

func (Pro) Timestamp

func (p Pro) Timestamp() int64

Timestamp 今天此刻时间戳

func (Pro) TimestampWithMicrosecond

func (p Pro) TimestampWithMicrosecond() int64

TimestampWithMicrosecond 今天微秒级时间戳

func (Pro) TimestampWithMillisecond

func (p Pro) TimestampWithMillisecond() int64

TimestampWithMillisecond 今天毫秒级时间戳

func (Pro) TimestampWithNanosecond

func (p Pro) TimestampWithNanosecond() int64

TimestampWithNanosecond 今天纳秒级时间戳

func (Pro) TimestampWithSecond

func (p Pro) TimestampWithSecond() int64

TimestampWithSecond 今天此刻时间戳

func (Pro) ToDateFormat

func (p Pro) ToDateFormat() string

ToDateFormat 今天此刻日期

func (Pro) ToTimeFormat

func (p Pro) ToTimeFormat() string

ToTimeFormat 今天此刻时间

Jump to

Keyboard shortcuts

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