Documentation ¶
Index ¶
- Constants
- func DateFromNow() string
- func DateFromTimeStamp(timestamp int64) string
- func DateTimeFromNow() string
- func DateTimeFromTimeStamp(timestamp int64) (string, string)
- func GetBetweenDates(start string, end string) []string
- func GetBetweenTimes(start string, end string) []string
- func GetDurationUntil(targetTime time.Time) int
- func GetDurationUntilMidnight() int
- func GetDurationUntilNextMonth() int
- func GetWeek() (y, w int)
- func TimeFromNow() string
- func TimeFromTimeStamp(timestamp int64) string
- func TimeNowStr() string
- func TimeStamptoDateTime(timestamp int64) string
- func TimestrToTimestamp(time_str string, flag int) int64
- type Ticker
- type TickerManager
Constants ¶
View Source
const ( DateLayout = "2006-01-02" TimeLayout = "15:04:05" DateTimeLayout = "2006-01-02 15:04:05" )
Variables ¶
This section is empty.
Functions ¶
func DateFromTimeStamp ¶
透過time.Now().Unix()出來的秒數轉為 "2006-01-02"
func DateTimeFromTimeStamp ¶
透過time.Now().Unix()出來的秒數轉為 "2006-01-02" "15:04:05"
func GetBetweenDates ¶
func GetBetweenTimes ¶
func GetDurationUntil ¶ added in v0.0.39
GetDurationUntil -取得到指定時間的時間差(秒)
func GetDurationUntilMidnight ¶ added in v0.0.39
func GetDurationUntilMidnight() int
GetDurationUntilMidnight -取得到當日0點的時間差(秒)
func GetDurationUntilNextMonth ¶ added in v0.0.39
func GetDurationUntilNextMonth() int
GetDurationUntilNextMonth -取得到次月1日0點的時間差(秒)
func TimeFromTimeStamp ¶
透過time.Now().Unix()出來的秒數轉為 "15:04:05"
Types ¶
type Ticker ¶
type Ticker struct {
// contains filtered or unexported fields
}
Ticker 定義一個Ticker,用於時間控制
type TickerManager ¶
type TickerManager struct {
// contains filtered or unexported fields
}
TickerManager 封裝一個tick的管理類,避免每次都要寫一大堆
func (*TickerManager) ClearTicker ¶
func (tm *TickerManager) ClearTicker(id uint64)
ClearTicker 清除tick, 停止tick
Click to show internal directories.
Click to hide internal directories.