Skip to content

Commit

Permalink
timex add some sub method
Browse files Browse the repository at this point in the history
  • Loading branch information
guanhui07 committed Oct 3, 2022
1 parent 7eaa5e5 commit 1f09356
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions timex/timex.go
Expand Up @@ -154,6 +154,11 @@ func (t *Time) AddDay(day int) *Time {
return t.AddSeconds(day * OneDaySec)
}

// SubDay add some day time for the time
func (t *Time) SubDay(day int) *Time {
return t.SubDay(day)
}

// Tomorrow time. get tomorrow time for the time
func (t *Time) Tomorrow() *Time {
return t.AddSeconds(OneDaySec)
Expand All @@ -170,11 +175,21 @@ func (t *Time) AddHour(hours int) *Time {
return t.AddSeconds(hours * OneHourSec)
}

// SubHour add some hour time
func (t *Time) SubHour(hours int) *Time {
return t.SubHour(hours)
}

// AddMinutes add some minutes time for the time
func (t *Time) AddMinutes(minutes int) *Time {
return t.AddSeconds(minutes * OneMinSec)
}

// SubMinutes add some minutes time for the time
func (t *Time) SubMinutes(minutes int) *Time {
return t.SubMinutes(minutes * OneMinSec)
}

// AddSeconds add some seconds time the time
func (t *Time) AddSeconds(seconds int) *Time {
return &Time{
Expand Down

0 comments on commit 1f09356

Please sign in to comment.