yay/pkg/text/time.go

16 lines
383 B
Go
Raw Normal View History

2020-06-26 09:15:36 +02:00
package text
import "time"
2021-08-11 20:13:28 +02:00
// Formats a unix timestamp to ISO 8601 date (yyyy-mm-dd).
2020-06-26 09:15:36 +02:00
func FormatTime(i int) string {
t := time.Unix(int64(i), 0)
return t.Format("2006-01-02")
}
2021-08-11 20:13:28 +02:00
// Formats a unix timestamp to ISO 8601 date (Mon 02 Jan 2006 03:04:05 PM MST).
2020-06-26 09:15:36 +02:00
func FormatTimeQuery(i int) string {
t := time.Unix(int64(i), 0)
return t.Format("Mon 02 Jan 2006 03:04:05 PM MST")
}