timeutil

package
v0.0.0-...-30c4fd9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DaysBetween

func DaysBetween(fromDate, toDate time.Time) int

DaysBetween return the number of whole days between a start date and end date

func EndOfMonth

func EndOfMonth(date time.Time) time.Time

EndOfMonth returns the last day of the month of date.

func FormatAsZulu

func FormatAsZulu(t time.Time) string

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

func MonthsTo(a time.Time) int

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

func StartOfMonth(date time.Time) time.Time

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL