MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / formatTime

Function formatTime

model/statistics_charts.go:373–386  ·  view source on GitHub ↗

formatTime 根据时间粒度格式化时间

(timestamp int64, defaultTime string)

Source from the content-addressed store, hash-verified

371
372// formatTime 根据时间粒度格式化时间
373func formatTime(timestamp int64, defaultTime string) string {
374 t := time.Unix(timestamp, 0)
375 switch defaultTime {
376 case "hour":
377 return t.Format("2006-01-02 15:00")
378 case "day":
379 return t.Format("2006-01-02")
380 case "week":
381 _, week := t.ISOWeek()
382 return t.Format("2006-01") + "-W" + strconv.Itoa(week)
383 default:
384 return t.Format("2006-01-02")
385 }
386}

Callers 3

GetChannelStatisticsFunction · 0.85
GetTokenStatisticsFunction · 0.85
GetUserStatisticsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected