u_time

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func CurrentMillis

func CurrentMillis() int64

func DurationFromNow added in v1.0.3

func DurationFromNow(millis int64) time.Duration

func DurationMillis

func DurationMillis(from int64, to int64) time.Duration

func DurationToNow added in v1.0.4

func DurationToNow(millis int64) time.Duration

func FormatDuration added in v1.0.3

func FormatDuration(d time.Duration, layout string) string

func HoChiMinhTz

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

func HoChiMinhTzDefaultLocal added in v1.0.6

func HoChiMinhTzDefaultLocal() *time.Location

func Millis2Str

func Millis2Str(format string, millis int64, loc *time.Location) string

func Millis2Time

func Millis2Time(millis int64) time.Time

func MillisToStartOfDay

func MillisToStartOfDay(millis int64, loc *time.Location) int64

func MustHoChiMinhTz

func MustHoChiMinhTz() *time.Location

func Str2Date added in v1.0.7

func Str2Date(text string, loc *time.Location) (*time.Time, error)

func Str2DateTime added in v1.0.7

func Str2DateTime(text string, loc *time.Location) (*time.Time, error)

func Str2Millis

func Str2Millis(format string, text string, loc *time.Location) (int64, error)

func Str2Month added in v1.0.7

func Str2Month(text string, loc *time.Location) (*time.Time, error)

func Str2Time

func Str2Time(format string, text string, loc *time.Location) (*time.Time, error)

func Time2EndMonth

func Time2EndMonth(t time.Time) time.Time

func Time2Millis

func Time2Millis(t time.Time) int64

func Time2StartMonth

func Time2StartMonth(t time.Time) time.Time

func ToDateStr

func ToDateStr(t time.Time, loc *time.Location) string

func ToDateTimeStr

func ToDateTimeStr(t time.Time, loc *time.Location) string

func ToMonthStr

func ToMonthStr(t time.Time, loc *time.Location) string

func Unix2Time

func Unix2Time(unix int64) time.Time

Types

type Date

type Date time.Time

func FromDateTime added in v1.0.3

func FromDateTime(dt time.Time) *Date

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