date

package
v0.0.0-...-e4caca2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Date

type Date struct {
	Base time.Time
}

Date generic date struc

func FromString

func FromString(expr string) (*Date, error)

FromString parse any string to Date

func FromTime

func FromTime(t time.Time) *Date

FromTime parse time to Date

func FromUnix

func FromUnix(sec int64) *Date

FomUnix parse timestamp to Date

func Now

func Now() *Date

Now return current date

func Parse

func Parse(in interface{}) (*Date, error)

func (*Date) Calculate

func (d *Date) Calculate(expr string) (*Date, error)

Calculate calculates relative date to given date

func (*Date) DiffDate

func (d *Date) DiffDate(t Date) time.Duration

DiffDate add date to given date return timestamp

func (*Date) DiffExpr

func (d *Date) DiffExpr(expr string) (time.Duration, error)

DiffExpr add expr to date return timestamp

func (*Date) DiffTime

func (d *Date) DiffTime(t time.Time) time.Duration

DiffTime add given time date return timestamp

func (*Date) DiffUnix

func (d *Date) DiffUnix(t int64) time.Duration

DiffUnix add int64 to given date then return timestamp

func (*Date) Format

func (d *Date) Format(expr string) string

Format formats given date

func (*Date) FormatS

func (d *Date) FormatS(expr string) string

FormatS format given date as strftime syntax

func (*Date) Midnight

func (d *Date) Midnight() *Date

Midnight return midnight of given date

func (*Date) Unix

func (d *Date) Unix() int64

Unix return timestamp of given date

func (*Date) UnixNano

func (d *Date) UnixNano() int64

UnixNano return nano timestamp of given date

Jump to

Keyboard shortcuts

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