Documentation
¶
Index ¶
- Constants
- func Format(t xtime.Time, layout string) string
- func InRange(t xtime.Time, start, end xtime.Time) bool
- func Parse(layout string, value string) (xtime.Time, error)
- func Random(max xtime.Duration) xtime.Duration
- func Tick(ctx context.Context, d xtime.Duration, f func() error) error
- func TimeNewest(times ...xtime.Time) xtime.Time
- type Duration
- type Item
Constants ¶
View Source
const DateFormat = "2006-01-02"
View Source
const FormatLayout = "2006-01-02 15:04:05"
Variables ¶
This section is empty.
Functions ¶
func Format ¶
Format returns a textual representation of the time value formatted according to layout, which defines the format by showing how the reference time Example Format(time.Now(), "YYYY-MM-DD HH:mm:ss")
layout defined by:
- YYYY = 2006,YY = 06
- MM = 01, MMM = Jan,MMMM = January
- DD = 02,
- DDD = Mon,DDDD = Monday
- HH = 15,hh = 03, h = 3
- mm = 04, m = 4
- ss = 05, m = 5
Types ¶
type Duration ¶
Duration be used toml unmarshal string time, like 1s, 500ms.
func (Duration) MarshalJSON ¶
func (Duration) Shrink ¶
Shrink will decrease the duration by comparing with context's timeout duration and return new timeout\context\CancelFunc.
func (*Duration) UnmarshalJSON ¶
func (*Duration) UnmarshalText ¶
UnmarshalText unmarshal text to duration.
Click to show internal directories.
Click to hide internal directories.