Documentation
¶
Index ¶
- Constants
- Variables
- func AddDateSeparator(date, separator string, incDay bool) string
- func GetDateSeparator(date string) string
- func GetShortDate(date string) string
- func IsLeapYear(year int) bool
- func NowTime() time.Time
- func NowTimeEx(timeZone string) time.Time
- func NowTimeText(format string) string
- func NowTimeTextEx(timeZone, format string) string
- func RemoveDateSeparator(date string) string
- func RemoveTimeFromDateTime(date string) string
- func ToDayEnd(t time.Time) time.Time
- func ToDayStart(t time.Time) time.Time
- func ToInt64(t time.Time, format string) int64
- type DateDifference
Constants ¶
View Source
const ( DefaultTimeZone = "" DefaultDateFormat = "yyyy-MM-dd" DefaultTimeFormat = "HH:mm:ss" DefaultDateTimeFormat = DefaultDateFormat + " " + DefaultTimeFormat )
Variables ¶
View Source
var DaysOfMonth = map[time.Month]int{ time.January: 31, time.February: 28, time.March: 31, time.April: 30, time.May: 31, time.June: 30, time.July: 31, time.August: 31, time.September: 30, time.October: 31, time.November: 30, time.December: 31, }
DaysOfMonth 每月的天数
Functions ¶
func AddDateSeparator ¶
AddDateSeparator 将YYYYMMDD格式的日期转换为YYYY-MM-DD格式或者YYYY-MM格式
func RemoveDateSeparator ¶
RemoveDateSeparator 去掉日期中的连接符-/和空格
func RemoveTimeFromDateTime ¶
RemoveTimeFromDateTime 将日期时间字符串中的时间信息去掉
func ToDayStart ¶
ToDayStart 将日期时间转换成 yyyy-MM-dd 00:00:00:000
Types ¶
type DateDifference ¶
DateDifference 日期差
func CalculateDateDifference ¶
func CalculateDateDifference(start, end time.Time) *DateDifference
CalculateDateDifference 计算日期差
Click to show internal directories.
Click to hide internal directories.