date

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: MIT Imports: 6 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 added in v0.9.0

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