dateUtil

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Ms      = "MS"
	Seconds = "SECOND"
	Minutes = "MINUTE"
	Hours   = "HOUR"
	Days    = "DAY"
)

Functions

func BeginOfDay added in v0.1.2

func BeginOfDay(beginDate time.Time) time.Time

BeginOfDay 一天的开始

func BeginOfMonth added in v0.1.2

func BeginOfMonth(beginDate time.Time) time.Time

BeginOfMonth 获取某月的开始时间

func Between added in v0.0.8

func Between(beginDate time.Time, endDate time.Time, unit string) int

Between 判断两个日期相差的时长,只保留绝对值 @param beginDate 起始日期 @param endDate 结束日期 @param unit 相差的单位 @return 日期差

func EndOfDay added in v0.1.2

func EndOfDay(beginDate time.Time) time.Time

EndOfDay 一天的结束

func EndOfMonth added in v0.1.2

func EndOfMonth(beginDate time.Time) time.Time

EndOfMonth 获取某月的结束时间

func Format added in v0.0.3

func Format(dateTime time.Time, format string) string

Format 格式化日期 @param dateTime 日期 @param format 日期格式:支持yyyy-MM-dd HH:mm:ss @return 格式化后的日期

func FormatInLocation added in v0.0.9

func FormatInLocation(dateTime time.Time, format string, name string) string

FormatInLocation 格式化时区日期 @param dateTime 日期 @param format 日期格式:支持yyyy-MM-dd HH:mm:ss @param name 时区:如 Asia/Shanghai @return 格式化后的日期

func FormatNow added in v0.0.3

func FormatNow(format string) string

FormatNow 格式化当前时间 @param format 日期格式:支持yyyy-MM-dd HH:mm:ss @return 格式化后的当前时间

func LastMonth added in v0.1.2

func LastMonth() time.Time

LastMonth 上个月

func LastWeek added in v0.1.2

func LastWeek() time.Time

LastWeek 上周

func LastYear added in v0.1.2

func LastYear() time.Time

LastYear 去年

func NextMonth added in v0.1.2

func NextMonth() time.Time

NextMonth 下个月

func NextWeek added in v0.1.2

func NextWeek() time.Time

NextWeek 下周

func NextYear added in v0.1.2

func NextYear() time.Time

NextYear 明年

func Now

func Now() string

Now 当前时间,格式 yyyy-MM-dd HH:mm:ss @return 当前时间的标准形式字符串

func NowTimeNoSeparate added in v0.0.3

func NowTimeNoSeparate() string

NowTimeNoSeparate 没有-的当前时间 yyyyMMddHHmmss @return 没有-的当前时间

func Parse added in v0.0.8

func Parse(dateTime string) time.Time

Parse 字符串转日期 @param dateTime 日期字符串 @return 日期

func ParseUTCFormatTZ added in v0.1.2

func ParseUTCFormatTZ(dateTime string) string

ParseUTCFormatTZ 时间日期字符串转UTC日期 @param dateTime 日期字符串 @return 日期

func Today added in v0.0.2

func Today() string

Today 当前日期字符串,格式:yyyy-MM-dd @return 当前日期的标准形式字符串

func Tomorrow added in v0.1.2

func Tomorrow() time.Time

Tomorrow 明天

func Yesterday added in v0.1.2

func Yesterday() time.Time

Yesterday 昨天

Types

This section is empty.

Jump to

Keyboard shortcuts

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