datetime

package
v0.0.0-...-50ba02b Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DateFormat     = "2006-01-02"
	DateTimeFormat = "2006-01-02T15:04:05"
	MonthFormat    = "2006-01"
)

Variables

This section is empty.

Functions

func CurrentUnixMills

func CurrentUnixMills() int64

func DurationBetween

func DurationBetween(fromMillis int64, toMillis int64) time.Duration

func DurationFromNow

func DurationFromNow(fromMillis int64) time.Duration

func GetDefaultLocation

func GetDefaultLocation() *time.Location

func HoChiMinhTz

func HoChiMinhTz() (*time.Location, error)

func LocalDateFromMillis

func LocalDateFromMillis(millis int64) string

func Millis2Time

func Millis2Time(millis int64) time.Time

func ParseDate

func ParseDate(input string) (*time.Time, error)

func ParseDateKeyToMillis

func ParseDateKeyToMillis(input string) (int64, error)

func ParseDateTime

func ParseDateTime(input string) (*time.Time, error)

func ParseDateTimeToMillis

func ParseDateTimeToMillis(input interface{}, isMillis bool) (*time.Time, error)

func ParseDateWithFormat

func ParseDateWithFormat(input string, format string) (*time.Time, error)

func RoundUpDateFromUnixTs

func RoundUpDateFromUnixTs(input int64, timezone string) (int64, error)

func Time2Millis

func Time2Millis(t time.Time) int64

func Time2Str

func Time2Str(t time.Time) string

func ToDateKey

func ToDateKey(millis int64, timezone string) (string, error)

func ToDayDate

func ToDayDate() string

func ToMonthKey

func ToMonthKey(millis int64, timezone string) (string, error)

func ToStringFormat

func ToStringFormat(millis int64, format string, timezone string) (string, error)

func UnixMillsAfter

func UnixMillsAfter(d time.Duration) int64

Types

type Date

type Date time.Time

func Today

func Today() *Date

func (*Date) MarshalJSON

func (d *Date) MarshalJSON() ([]byte, error)

func (*Date) ToEpochUnix

func (d *Date) ToEpochUnix() int64

func (*Date) ToString

func (d *Date) ToString() string

func (*Date) ToTime

func (d *Date) ToTime() time.Time

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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