Documentation ¶
Index ¶
- Constants
- Variables
- func BeginOfDay() time.Time
- func BeginOfDuration(d time.Duration) time.Time
- func BeginOfMonth() time.Time
- func BeginOfWeek() time.Time
- func BeginOfYear() time.Time
- func EndOfDay() time.Time
- func EndOfMonth() time.Time
- func EndOfWeek() time.Time
- func EndOfYear() time.Time
- func FindStringSubmatchMap(s, exp string) (map[string]string, bool)
- func FormatChineseDate(t time.Time) string
- func FormatChineseDateTime(t time.Time) string
- func FormatChineseZDate(t time.Time) string
- func FormatChineseZDateTime(t time.Time) string
- func FormatDashTime(t time.Time) string
- func FormatDate(t time.Time) string
- func FormatDateTime(t time.Time) string
- func FormatHTTPGMT(t time.Time) string
- func FormatLayoutTime(t time.Time, layout string) string
- func FormatRFC3339(t time.Time) string
- func FormatRFC3339Nano(t time.Time) string
- func FormatTime(t time.Time) string
- func FormatZDate(t time.Time) string
- func GbkToUtf8(s []byte) ([]byte, error)
- func GetMonthDays(year, month int) int
- func GetTimeMonthDays(t time.Time) int
- func HideString(origin string, start, length int) string
- func IntToString(value interface{}) (string, error)
- func IsZero(t time.Time) bool
- func ParseChineseDate(t string) (time.Time, error)
- func ParseChineseDateTime(t string) (time.Time, error)
- func ParseDate(t string) (time.Time, error)
- func ParseDateTime(t string) (time.Time, error)
- func ParseInLocation(layout, timestring string, loc *time.Location) (time.Time, error)
- func ParseLayoutTime(layout, timestring string) (time.Time, error)
- func ParseStringByteSize(key string) *big.Int
- func ParseStringTime(s string, defValue ...time.Duration) time.Duration
- func QuoteBytesToASCIIWithoutBackslashed(bs []byte) string
- func QuoteToASCIIWithoutBackslashed(s string) string
- func RemoveDuplicateStringByMap(ss []string) []string
- func RoundFund(fund float64) int64
- func StringContainedInSlice(needle string, haystack []string) bool
- func StringInSlice(needle string, haystack []string) bool
- func StringToDate(t string) (time.Time, error)
- func StringToDateTime(t string) (time.Time, error)
- func SuffixStringInSlice(needle string, haystack []string) bool
- func ToFloat64(value interface{}) (float64, error)
- func ToInt(value interface{}) (int, error)
- func ToInt64(value interface{}) (int64, error)
- func UnixToTime(unix int64) time.Time
- func Utf8ToGbk(s []byte) ([]byte, error)
- type Config
- type Int64s
- type Ints
- type Now
- func (p *Now) BeginOfDay() time.Time
- func (p *Now) BeginOfDuration(d time.Duration) time.Time
- func (p *Now) BeginOfMonth() time.Time
- func (p *Now) BeginOfWeek() time.Time
- func (p *Now) BeginOfYear() time.Time
- func (p *Now) EndOfDay() time.Time
- func (p *Now) EndOfMonth() time.Time
- func (p *Now) EndOfWeek() time.Time
- func (p *Now) EndOfYear() time.Time
- func (p *Now) Monday() time.Time
- func (p *Now) Now() time.Time
- func (*Now) ParseInLocation(layout, timestring string, loc *time.Location) (time.Time, error)
- func (p *Now) ParseLayoutTime(layout, s string) (time.Time, error)
- func (p *Now) Sunday() time.Time
- func (p *Now) WithLocation(loc *time.Location)
- type NowOption
- type Strings
- type Times
- type Uint32s
- type Uints
Constants ¶
const ( Date = "2006-01-02" ZDate = "2006-1-2" Time = "15:04:05" DashTime = Date + "-15-04-05" DateTime = Date + " " + Time ChineseDate = "2006年01月02日" ChineseZDate = "2006年1月2日" ChineseDateTime = "2006年01月02日15时04分05秒" ChineseZDateTime = "2006年1月2日15时4分5秒" DefaultDateTime = "0001-01-01 00:00:00" )
Datas
const ( MonthLunarDays int = 30 MonthSolarDays int = 31 MonthFebLeapDays int = 29 MonthFebDays int = 28 )
MonthDays
Variables ¶
var ( // WeekStartDay 一周的开始时间 WeekStartDay = time.Sunday )
Functions ¶
func BeginOfDuration ¶ added in v1.3.0
BeginOfDuration 以当前的时间作为起始时间,抹掉一部分时间
func FindStringSubmatchMap ¶
FindStringSubmatchMap infomation: returns a map of strings holding the text of the leftmost match of the regular expression in s and the matches, if any, of its subexpressions, as defined by the 'Submatch' description in the package comment. A return value of nil indicates no match.
func FormatChineseDateTime ¶ added in v1.3.0
FormatChineseDateTime 格式化中国日期时间
func FormatChineseZDateTime ¶ added in v1.3.0
FormatChineseZDateTime 格式化去0的中国日期时间
func FormatDashTime ¶
FormatDashTime format datetime string with dash
func FormatHTTPGMT ¶ added in v1.3.0
FormatHTTPGMT format GMT string
func FormatLayoutTime ¶ added in v1.3.0
FormatLayoutTime 格式化自定义的时间
func FormatRFC3339Nano ¶
FormatRFC3339Nano format RFC3339Nano string
func GetTimeMonthDays ¶
GetTimeMonthDays get time's month days
func HideString ¶
HideString hide some words origin: the string to be hidden start: from 1 to len(origin), replace * from beginning length: replace origin length from the beginning
func IntToString ¶
IntToString parse int to string
func ParseChineseDate ¶ added in v1.3.0
ParseChineseDate 转换中文日期格式为cacheLocation的时间
func ParseChineseDateTime ¶ added in v1.3.0
ParseChineseDateTime 转换中文时间格式为cacheLocation的时间
func ParseDateTime ¶ added in v1.3.0
ParseDateTime 转换时间格式为cacheLocation的时间
func ParseInLocation ¶ added in v1.3.0
ParseInLocation 解析时间
func ParseLayoutTime ¶ added in v1.3.0
ParseLayoutTime 解析时间
func ParseStringByteSize ¶
ParseStringByteSize return big size
func ParseStringTime ¶
ParseStringTime return time.Duration
func QuoteBytesToASCIIWithoutBackslashed ¶
QuoteBytesToASCIIWithoutBackslashed strconv.QuoteToASCII by bytes
func QuoteToASCIIWithoutBackslashed ¶
QuoteToASCIIWithoutBackslashed strconv.QuoteToASCII without Backslashed \\ import strconv
func RemoveDuplicateStringByMap ¶ added in v1.8.0
RemoveDuplicateStringByMap remove duplicate string by map whether a string is already exist.
func StringContainedInSlice ¶ added in v1.8.0
StringContainedInSlice a string contains a short string in haystack
func StringInSlice ¶ added in v1.8.0
StringInSlice a string in haystack
func StringToDate ¶
StringToDate paser string to date, but is deprecated, use ParseDate
func StringToDateTime ¶
StringToDateTime parse string to datetime, but is deprecated, use ParseDateTime
func SuffixStringInSlice ¶ added in v1.8.0
SuffixStringInSlice a string starts with a short string in haystack
Types ¶
type Now ¶ added in v1.3.0
Now now time
func (*Now) BeginOfDay ¶ added in v1.3.0
BeginOfDay begin of day
func (*Now) BeginOfDuration ¶ added in v1.3.0
BeginOfDuration 获取当前时间,并抹掉一部分时间
func (*Now) BeginOfMonth ¶ added in v1.3.0
BeginOfMonth begin of month
func (*Now) BeginOfWeek ¶ added in v1.3.0
BeginOfWeek begin of week
func (*Now) BeginOfYear ¶ added in v1.3.0
BeginOfYear begin of year
func (*Now) EndOfMonth ¶ added in v1.3.0
EndOfMonth begin of month
func (*Now) ParseInLocation ¶ added in v1.3.0
ParseInLocation 解析时间
func (*Now) ParseLayoutTime ¶ added in v1.3.0
ParseLayoutTime 解析时间
func (*Now) WithLocation ¶ added in v1.3.0
WithLocation 设置时区
type NowOption ¶ added in v1.3.0
type NowOption func(*Now)
NowOption 执行函数
func NowLocation ¶ added in v1.3.0
NowLocation 设置时间Location
func NowWeekStartDay ¶ added in v1.3.0
NowWeekStartDay 设置一周开始时间
type Times ¶ added in v1.3.0
type Times interface { Now() time.Time Monday() time.Time Sunday() time.Time BeginOfDay() time.Time EndOfDay() time.Time BeginOfWeek() time.Time EndOfWeek() time.Time BeginOfMonth() time.Time EndOfMonth() time.Time BeginOfYear() time.Time EndOfYear() time.Time BeginOfDuration(d time.Duration) time.Time ParseLayoutTime(layout, timestring string) (time.Time, error) ParseInLocation(layout, timestring string, loc *time.Location) (time.Time, error) WithLocation(loc *time.Location) }
Times 时间处理函数
func WithLocation ¶ added in v1.3.1
WithLocation 返回带自定义Location的时间