misc

package
v0.0.0-...-bd7d7c7 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MM_DD                      = "MM-dd"
	YYYYMM                     = "yyyyMM"
	YYYY_MM                    = "yyyy-MM"
	YYYY_MM_DD                 = "yyyy-MM-dd"
	YYYYMMDD                   = "yyyyMMdd"
	YYYYMMDDHHMMSS             = "yyyyMMddHHmmss"
	YYYYMMDDHHMM               = "yyyyMMddHHmm"
	YYYYMMDDHH                 = "yyyyMMddHH"
	YYMMDDHHMM                 = "yyMMddHHmm"
	MM_DD_HH_MM                = "MM-dd HH:mm"
	MM_DD_HH_MM_SS             = "MM-dd HH:mm:ss"
	YYYY_MM_DD_HH_MM           = "yyyy-MM-dd HH:mm"
	YYYY_MM_DD_HH_MM_SS        = "yyyy-MM-dd HH:mm:ss"
	YYYY_MM_DD_HH_MM_SS_SSS    = "yyyy-MM-dd HH:mm:ss.SSS"
	MM_DD_EN                   = "MM/dd"
	YYYY_MM_EN                 = "yyyy/MM"
	YYYY_MM_DD_EN              = "yyyy/MM/dd"
	MM_DD_HH_MM_EN             = "MM/dd HH:mm"
	MM_DD_HH_MM_SS_EN          = "MM/dd HH:mm:ss"
	YYYY_MM_DD_HH_MM_EN        = "yyyy/MM/dd HH:mm"
	YYYY_MM_DD_HH_MM_SS_EN     = "yyyy/MM/dd HH:mm:ss"
	YYYY_MM_DD_HH_MM_SS_SSS_EN = "yyyy/MM/dd HH:mm:ss.SSS"
	MM_DD_CN                   = "MM月dd日"
	YYYY_MM_CN                 = "yyyy年MM月"
	YYYY_MM_DD_CN              = "yyyy年MM月dd日"
	MM_DD_HH_MM_CN             = "MM月dd日 HH:mm"
	MM_DD_HH_MM_SS_CN          = "MM月dd日 HH:mm:ss"
	YYYY_MM_DD_HH_MM_CN        = "yyyy年MM月dd日 HH:mm"
	YYYY_MM_DD_HH_MM_SS_CN     = "yyyy年MM月dd日 HH:mm:ss"
	HH_MM                      = "HH:mm"
	HH_MM_SS                   = "HH:mm:ss"
	HH_MM_SS_MS                = "HH:mm:ss.SSS"
)

Variables

This section is empty.

Functions

func AddMonthForUnix

func AddMonthForUnix(month string, layout string, num int) int64

* @description: Return Add Month To Time String For Month @param month: time string @param layout: time format e.g. 2006-01-02 15:04:05 @param num: add nums @return: Timespan

func Date

func Date(tm time.Time) int64

* @description: Return Time Day's Timespan @param tm: Time @return: timespan

func DateToUnix

func DateToUnix(date string, format string) int64

* @description: Return Time Year's Timespan @param date: time string @param format: time format @return: timespan

func FirstAndLastUnixOfMonth

func FirstAndLastUnixOfMonth(month string, layout string) (s int64, e int64)

* @description: Return First Day And Last Day of Month @param month: time string @param layout: time format e.g. 2006-01-02 15:04:05 @return: Timespan

func FirstAndLastUnixOfWeek

func FirstAndLastUnixOfWeek(date int64) (s int64, e int64)

* @description: Return First Day And Last Day of Week @param date: timespan @return: Week's First TimeSpan and Last TimeSpan

func FirstAndLastUnixOfYear

func FirstAndLastUnixOfYear(month string, layout string) (s int64, e int64)

* @description: Return First Day And Last Day of Year @param month: time string @param layout: time format e.g. 2006-01-02 15:04:05 @return: Timespan

func FirstDayOfMonth

func FirstDayOfMonth(month string, layout string) int

* @description: Return First Day of Month @param month: time string @param layout: time format e.g. 2006-01-02 15:04:05 @return: Timespan

func Float64ToString

func Float64ToString(f float64) string

* @description:Float64 To String @param f: Float64 @return: string

func FormatDate

func FormatDate(date time.Time, dateStyle string) string

* @description: FormatDate By dateStyle @param date: time @param dateStyle: dateStyle @return: Format String

func GetGuid

func GetGuid() string

* @description: Get UUID @param : None @return: string

func GetMd5String

func GetMd5String(s string) string

* @description: Get 32 byte MD5 @param s: string @return: string

func LastDayOfMonth

func LastDayOfMonth(month string, layout string) int

* @description: Return Last Day of Month @param month: time string @param layout: time format e.g. 2006-01-02 15:04:05 @return: Timespan

func Month

func Month(tm time.Time) int64

* @description: Return Time Month's Timespan @param tm: Time @return: timespan

func PathExists

func PathExists(path string) (bool, error)

func SliceArray

func SliceArray(size int, arr interface{}, beans interface{}) (error, interface{})

func StringPadLeft

func StringPadLeft(str, pad string, length int) string

* @description:Add Pad At The Start of String Util The Length of String Equals length @param str: The Original String @param pad: The Added String @param length: total length of string @return: string

func StringPadRight

func StringPadRight(str, pad string, length int) string

* @description:Add Pad At The End of String Util The Length of String Equals length @param str: The Original String @param pad: The Added String @param length: total length of string @return: string

func StringToFloat64

func StringToFloat64(s string) float64

* @description: String To Float64 @param s: string @return: Float64

func UnixToDate

func UnixToDate(ts int64, format string) string

* @description: Return Timespan's Format String @param ts: timespasn @param format: time format e.g. 2006-01-02 15:04:05 @return: Timespan

func Year

func Year(tm time.Time) int64

* @description: Return Time Year's Timespan @param tm: Time @return: timespan

Types

This section is empty.

Jump to

Keyboard shortcuts

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