package timeutil
import "github.com/teamwork/utils/timeutil"
Index ¶
- func DaysBetween(fromDate, toDate time.Time) int
- func EndOfMonth(date time.Time) time.Time
- func FormatAsZulu(t time.Time) string
- func MonthsTo(a time.Time) int
- func StartOfMonth(date time.Time) time.Time
- func UnixMilli() int64
Functions ¶
func DaysBetween ¶
DaysBetween return the number of whole days between a start date and end date
func EndOfMonth ¶
EndOfMonth returns the last day of the month of date.
func FormatAsZulu ¶
FormatAsZulu gets a ISO 8601 formatted date. The date is assumed to be in UTC ("Zulu time").
TODO: I think we can just use t.Format(time.RFC3339)?
func MonthsTo ¶
MonthsTo returns the number of months from the current date to the given date. The number of months is always rounded down, with a minimal value of 1.
For example this returns 2:
MonthsTo(time.Now().Add(24 * time.Hour * 70))
Dates in the past are not supported, and their behaviour is undefined!
func StartOfMonth ¶
StartOfMonth returns the first day of the month of date.
func UnixMilli ¶
func UnixMilli() int64
UnixMilli returns the number of milliseconds elapsed since January 1, 1970 UTC.
Source Files ¶
- Version
- v1.0.0 (latest)
- Published
- Mar 14, 2022
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 10 hours ago –
Tools for package owners.