Documentation
¶
Index ¶
- Constants
- func GetTimeNow() time.Time
- func GetTimeNowUTC() time.Time
- func Hours(n int) time.Duration
- func Microseconds(n int) time.Duration
- func Milliseconds(n int) time.Duration
- func Minutes(n int) time.Duration
- func Nanoseconds(n int) time.Duration
- func Seconds(n int) time.Duration
- func Weekof(date time.Time) time.Time
- func YearWeek(date time.Time) string
- type FloatTime
- type GetTime
Constants ¶
const FmtYearWeek = "%d%02d"
FmtYearWeek is the format string used by fmt.Println to create a 6 digit string of the yearweek ('YYYYWW'). e.g. `y, w := t.ISOWeek(); fmt.Sprintf(FmtYearWeek, y, w)`
const (
MySQLDateTime = "2006-01-02 15:04:05"
)
Variables ¶
This section is empty.
Functions ¶
func GetTimeNow ¶ added in v0.1.0
GetTimeNow fulfills GetTime and is a function that return the current time
func GetTimeNowUTC ¶ added in v0.1.0
GetTimeNowUTC fulfills GetTime and is a function that return the current UTC time
func Hours ¶
Hours returns a duration based on ints. time.Duration is an int64, but there are times when the return value of funcs or other operations aren't int64. This is pure sugar for casting an int to a time.Duration before doing the math.
func Microseconds ¶
Microseconds returns a duration based on ints. time.Duration is an int64, but there are times when the return value of funcs or other operations aren't int64. This is pure sugar for casting an int to a time.Duration before doing the math.
func Milliseconds ¶
Milliseconds returns a duration based on ints. time.Duration is an int64, but there are times when the return value of funcs or other operations aren't int64. This is pure sugar for casting an int to a time.Duration before doing the math.
func Minutes ¶
Minutes returns a duration based on ints. time.Duration is an int64, but there are times when the return value of funcs or other operations aren't int64. This is pure sugar for casting an int to a time.Duration before doing the math.
func Nanoseconds ¶
Nanoseconds returns a duration based on ints. time.Duration is an int64, but there are times when the return value of funcs or other operations aren't int64. This is pure sugar for casting an int to a time.Duration before doing the math.
func Seconds ¶
Seconds returns a duration based on ints. time.Duration is an int64, but there are times when the return value of funcs or other operations aren't int64. This is pure sugar for casting an int to a time.Duration before doing the math.
func Weekof ¶
Weekof returns the time.Time anchored to the Monday of the week of the given time.Time. This is useful for communicating ISO 8601 weeks. See https://golang.org/pkg/time/#Time.ISOWeek
Types ¶
type FloatTime ¶ added in v0.2.0
FloatTime allows the JSON Un/Marshaling of timestamps sent as floats into time.Time
func NewFloatTime ¶ added in v0.2.0
func NewFloatTime() *FloatTime
NewFloatTime allows the JSON Un/Marshaling of timestamps sent as floats into time.Time
func (*FloatTime) MarshalJSON ¶ added in v0.2.0
MarshalJSON satisfies the json.Marshaler interface
func (*FloatTime) Unix ¶ added in v0.2.0
Unix is shorthand for getting the regular unix timestamp from a FloatTime
func (*FloatTime) UnmarshalJSON ¶ added in v0.2.0
MarshalJSON satisfies the json.Unmarshaler interface