Documentation ¶
Index ¶
- Constants
- func Bod(t time.Time) time.Time
- func GetTimeAndWeekday(timeDateTime time.Time) (time.Time, uint)
- func IsBetween(dateTime, startTime, endTime time.Time) bool
- func IsExpired(dateTime time.Time, seconds int) bool
- func IsScheduled(t time.Time, d time.Duration) bool
- func IsWeekday(t time.Time) bool
- func Max(a time.Time, b time.Time) time.Time
- func Millisecond(input time.Time) int64
- func NextQuarterOfHour(t time.Time) time.Time
- func NowInMS() int64
- func RoundUp(t time.Time, d time.Duration) time.Time
- func UnixWithMS(ts int64) time.Time
- type DateOnly
- func (t *DateOnly) GobDecode(data []byte) error
- func (t *DateOnly) GobEncode() ([]byte, error)
- func (t *DateOnly) IsEmpty() bool
- func (t *DateOnly) MarshalJSON() ([]byte, error)
- func (t *DateOnly) ParseString(input string) error
- func (t *DateOnly) Scan(value interface{}) error
- func (t *DateOnly) String() string
- func (t *DateOnly) UnmarshalJSON(input []byte) error
- func (t DateOnly) Value() (driver.Value, error)
- type Duration
- type RFC3339
- func (t RFC3339) EncodeValues(key string, v *url.Values) error
- func (t RFC3339) Equal(u RFC3339) bool
- func (t *RFC3339) GobDecode(data []byte) error
- func (t *RFC3339) GobEncode() ([]byte, error)
- func (t *RFC3339) IsEmpty() bool
- func (t *RFC3339) IsInvalid() bool
- func (t RFC3339) MarshalJSON() ([]byte, error)
- func (t *RFC3339) ParseString(input string) error
- func (t *RFC3339) Scan(src interface{}) error
- func (t RFC3339) String() string
- func (t *RFC3339) UnmarshalJSON(input []byte) error
- func (t RFC3339) Value() (driver.Value, error)
- type TimeOnly
- func (t *TimeOnly) GobDecode(data []byte) error
- func (t *TimeOnly) GobEncode() ([]byte, error)
- func (t *TimeOnly) IsEmpty() bool
- func (t *TimeOnly) MarshalJSON() ([]byte, error)
- func (t *TimeOnly) ParseString(input string) error
- func (t *TimeOnly) String() string
- func (t *TimeOnly) UnmarshalJSON(input []byte) error
Constants ¶
const (
// DBFormat is the date format used to store date in mysql db
DBFormat = "2006-01-02 15:04:05"
)
const DateOnlyFormat = "2006-01-02"
DateOnlyFormat defines the format to store/parse the time for DateOnly struct
const TimeOnlyFormat = "15:04" //"15:04:05.999999999"
TimeOnlyFormat defines the format to store/parse the time for TimeOnly struct
Variables ¶
This section is empty.
Functions ¶
func Bod ¶
Bod returns the beginning of day time within a particular timezone http://stackoverflow.com/questions/25254443/return-local-beginning-of-day-time-object-in-go
func GetTimeAndWeekday ¶
GetTimeAndWeekday converts the time in seconds to a hh:mm only and its weekday bitmask
func IsScheduled ¶
IsScheduled returns true if t falls on a multiple of d. If d is 15 minutes, then IsScheduled returns true if t falls on any quarter of the hour, false otherwise.
func Millisecond ¶
Millisecond returns number of milliseconds elapsed since January 1, 1970 UTC,until the input time. NOTE: a date before the year 1678 or after 2262 cannot be represented correctly
func NextQuarterOfHour ¶
NextQuarterOfHour returns the next quarter of an hour from t. if t is already on the quarter, then return t.
func NowInMS ¶
func NowInMS() int64
NowInMS returns number of million seconds elapsed since January 1, 1970 UTC till now NOTE: a date before the year 1678 or after 2262 cannot be represented correctly
func RoundUp ¶
RoundUp returns the result of rounding t to the next multiple of d (since the zero time). RoundUp returns t unchanged if d <= 0 or t is a multiple of d.
func UnixWithMS ¶
UnixWithMS returns the local Time corresponding to the given Unix milliseconds since January 1, 1970 UTC
Types ¶
type DateOnly ¶
DateOnly type wraps json marshal and unmarshal operations on time.Time type using DateOnly format
func DateOnlyFromString ¶
DateOnlyFromString creates DateOnly from a string
func (*DateOnly) MarshalJSON ¶
MarshalJSON marshals a DateOnly type to json
func (*DateOnly) ParseString ¶
ParseString parses a string and modifies the receiver
func (*DateOnly) UnmarshalJSON ¶
UnmarshalJSON unmarshals DateOnly type from json
type Duration ¶
Duration is struct which wraps time.Duration and implements json.Unmarshaler and json.Marshaler copied from https://github.com/golang/go/issues/4712
func (Duration) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface
type RFC3339 ¶
RFC3339 type wraps json marshal and unmarshal operations on time.Time type using RFC3339 format
func FromString ¶
FromString create RFC3339 from string
func (RFC3339) EncodeValues ¶
EncodeValues allows us to use go-querystring and encode grabtime
func (RFC3339) MarshalJSON ¶
MarshalJSON marshal RFC3339 type to json
func (*RFC3339) ParseString ¶
ParseString parse string and modify receiver
func (*RFC3339) UnmarshalJSON ¶
UnmarshalJSON unmarshal RFC3339 from json
type TimeOnly ¶
TimeOnly type wraps json marshal and unmarshal operations on time.Time type using TimeOnly format
func TimeOnlyFromString ¶
TimeOnlyFromString create TimeOnly from string
func (*TimeOnly) MarshalJSON ¶
MarshalJSON marshal TimeOnly type to json
func (*TimeOnly) ParseString ¶
ParseString parse string and modify receiver
func (*TimeOnly) UnmarshalJSON ¶
UnmarshalJSON unmarshal TimeOnly from json