Documentation
¶
Overview ¶
Package timeutil provides utility functions and types for working with time-related operations.
Index ¶
- Constants
- Variables
- func DayFormat(t time.Time) int
- func DaysIn(t time.Time) int
- func FromStr(timeStr string) (time.Time, error)
- func MinsToHoursAndMins(val int) (hrs, mins int)
- func Round(t float64) int
- func RoundToEnd(t time.Time) time.Time
- func RoundToStart(t time.Time) time.Time
- func ToKey(t time.Time) []byte
- type Period
Constants ¶
View Source
const ( HoursInADay = 24 MaxHoursInAMonth = 744 // 31 day months MaxHoursInAYear = 8784 // Leap years )
Variables ¶
View Source
var PeriodCollection = []Period{ PeriodAllTime, PeriodToday, PeriodYesterday, Period7Days, Period14Days, Period30Days, Period90Days, Period180Days, Period365Days, }
View Source
var Range = map[Period]int{ PeriodAllTime: 0, PeriodToday: 0, PeriodYesterday: -1, Period7Days: -6, Period14Days: -13, Period30Days: -29, Period90Days: -89, Period180Days: -179, Period365Days: -364, }
Functions ¶
func MinsToHoursAndMins ¶
MinsToHoursAndMins expresses a minutes value in hours and mins.
func RoundToEnd ¶
RoundToEnd resets the given time to the end of the day.
func RoundToStart ¶
RoundToStart resets the given time to the start of the day.
Types ¶
Click to show internal directories.
Click to hide internal directories.