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, defValue ...*big.Int) *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 Duration
- type Hide
- 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
const Hidden = "<hidden>"
Variables ¶
var ( // WeekStartDay 一周的开始时间 WeekStartDay = time.Sunday )
Functions ¶
func BeginOfDuration ¶
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 ¶
FormatChineseDateTime 格式化中国日期时间
func FormatChineseZDateTime ¶
FormatChineseZDateTime 格式化去0的中国日期时间
func FormatDashTime ¶
FormatDashTime format datetime string with dash
func FormatLayoutTime ¶
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 ¶
ParseChineseDate 转换中文日期格式为cacheLocation的时间
func ParseChineseDateTime ¶
ParseChineseDateTime 转换中文时间格式为cacheLocation的时间
func ParseDateTime ¶
ParseDateTime 转换时间格式为cacheLocation的时间
func ParseInLocation ¶
ParseInLocation 解析时间
func ParseLayoutTime ¶
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 ¶
RemoveDuplicateStringByMap remove duplicate string by map whether a string is already exist.
func StringContainedInSlice ¶
StringContainedInSlice a string contains a short string in haystack
func StringInSlice ¶
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 ¶
SuffixStringInSlice a string starts with a short string in haystack
Types ¶
type Duration ¶ added in v0.21.8
func (Duration) MarshalYAML ¶ added in v0.21.8
MarshalYAML implements the yaml.Marshaler interface.
func (*Duration) UnmarshalYAML ¶ added in v0.21.8
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Hide ¶ added in v0.21.15
type Hide string
func (Hide) MarshalJSON ¶ added in v0.21.15
MarshalJSON implements the json.Marshaler interface for Hide.
func (Hide) MarshalYAML ¶ added in v0.21.15
MarshalYAML implements the yaml.Marshaler interface for Hide.
func (*Hide) UnmarshalYAML ¶ added in v0.21.15
UnmarshalYAML implements the yaml.Unmarshaler interface for Hide.
type Now ¶
Now now time
func (*Now) BeginOfDuration ¶
BeginOfDuration 获取当前时间,并抹掉一部分时间
func (*Now) ParseInLocation ¶
ParseInLocation 解析时间
func (*Now) ParseLayoutTime ¶
ParseLayoutTime 解析时间
type Times ¶
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 时间处理函数