8000 GitHub - gmaisto/timeutils: Go collection of small time related utility functions
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

gmaisto/timeutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

timeutils

Go collection of small time related utility functions (Alpha)

timeutils

-- import "gmaisto/timeutils"

Usage

type Now

type Now struct {
	time.Time
}

Now a simple wrapper of time.Time

func New

func New(n time.Time) *Now

New return a new instance of Now

func (*Now) AddDays

func (t *Now) AddDays(n int) time.Time

AddDays add a number of days at Now

func (*Now) Ago

func (t *Now) Ago(seconds int64) time.Time

Ago return a time instance representing the time a given number of seconds ago

func (*Now) BeginningOfDay

func (t *Now) BeginningOfDay() time.Time

BeginningOfDay return a time instance for the beginning of the day

func (*Now) DayOfWeekAfterNDays

func (t *Now) DayOfWeekAfterNDays(n int) time.Weekday

DayOfWeekAfterNDays return the day of week after a specified number of days from the given time instance

func (*Now) DaysInMonth

func (t *Now) DaysInMonth() int

DaysInMonth return the number of days in the month which t is in

func (*Now) EndOfDay

func (t *Now) EndOfDay() time.Time

EndOfDay return a time instance for the end of the day

func (*Now) IsLeap

func (t *Now) IsLeap() bool

IsLeap return true if the Year in t is a leap year

func (*Now) NewTimeAfterInterval

func (t *Now) NewTimeAfterInterval(istart time.Time, iend time.Time, length int64) time.Time

NewTimeAfterInterval return a new time instance obtained adding "length" seconds to the original time instance excluding an interval of time

func (*Now) NextMonth

func (t *Now) NextMonth() time.Month

NextMonth return the next month (time.Month)

func (*Now) PreviousMonth

func (t *Now) PreviousMonth() time.Month

PreviousMonth return the next month (time.Month)

func (*Now) SecondsToEndOfDay

func (t *Now) SecondsToEndOfDay() int32

SecondsToEndOfDay return the number of seconds to the end of the day

func (*Now) Since

func (t *Now) Since(seconds int64) time.Time

Since return a time instance representing the time a given seconds since the instance time

func (*Now) Tomorrow

func (t *Now) Tomorrow() time.Time

Tomorrow return a time instance for tomorrows date at the same time

func (*Now) TomorrowAtTime

func (t *Now) TomorrowAtTime(w time.Time) time.Time

TomorrowAtTime return a time instance for tomorrow's date at a given time of day

func (*Now) TomorrowDayOfWeek

func (t *Now) TomorrowDayOfWeek() time.Weekday

TomorrowDayOfWeek return the day of the week of tomorrow

func (*Now) Yesterday

func (t *Now) Yesterday() time.Time

Yesterday return a time instance for yesterday's date at the same time

func (*Now) YesterdayAtTime

func (t *Now) YesterdayAtTime(w time.Time) time.Time

YesterdayAtTime return a time instance for yesterday's date at a given time of day

func (*Now) YesterdayDayOfWeek

func (t *Now) YesterdayDayOfWeek() time.Weekday

YesterdayDayOfWeek return the day of week of yesterday

About

Go collection of small time related utility functions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0