Documentation
¶
Index ¶
- Constants
- func Format(time time.Time, layout string) string
- func FromTimestamp(timestamp int64) time.Time
- func FromUnix(unix int64) time.Time
- func GetDay(time time.Time) int
- func NowTimestamp() int64
- func NowUnix() int64
- func Parse(timeStr, layout string) (time.Time, error)
- func PrettyTime(milliseconds int64) string
- func Timestamp(t time.Time) int64
- func WithTimeAsStartOfDay(t time.Time) time.Time
Constants ¶
View Source
const ( FmtDate = "2006-01-02" FmtTime = "15:04:05" FmtDateTime = "2006-01-02 15:04:05" FmtDateTimeNoSeconds = "2006-01-02 15:04" )
Variables ¶
This section is empty.
Functions ¶
func PrettyTime ¶
PrettyTime *
- 将时间格式换成 xx秒前,xx分钟前...
- 规则:
- 59秒--->刚刚
- 1-59分钟--->x分钟前(23分钟前)
- 1-24小时--->x小时前(5小时前)
- 昨天--->昨天 hh:mm(昨天 16:15)
- 前天--->前天 hh:mm(前天 16:15)
- 前天以后--->mm-dd(2月18日)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.