v0.0.246 timeext
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m11s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m11s
This commit is contained in:
parent
39a0b73d56
commit
ec9ac26a4c
@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.245"
|
const GoextVersion = "0.0.246"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2023-08-21T13:27:36+0200"
|
const GoextVersionTimestamp = "2023-08-21T14:15:06+0200"
|
||||||
|
@ -22,6 +22,17 @@ func TimeToDatePart(t time.Time, tz *time.Location) time.Time {
|
|||||||
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
|
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TimeToDayStart returns a timestamp at the start of the day which contains t (= 00:00:00)
|
||||||
|
func TimeToDayStart(t time.Time, tz *time.Location) time.Time {
|
||||||
|
t = t.In(tz)
|
||||||
|
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimeToDayEnd returns a timestamp at the end of the day which contains t (= 23:59:59)
|
||||||
|
func TimeToDayEnd(t time.Time, tz *time.Location) time.Time {
|
||||||
|
return TimeToDayStart(t, tz).AddDate(0, 1, 0).Add(-1)
|
||||||
|
}
|
||||||
|
|
||||||
// TimeToWeekStart returns a timestamp at the start of the week which contains t (= Monday 00:00:00)
|
// TimeToWeekStart returns a timestamp at the start of the week which contains t (= Monday 00:00:00)
|
||||||
func TimeToWeekStart(t time.Time, tz *time.Location) time.Time {
|
func TimeToWeekStart(t time.Time, tz *time.Location) time.Time {
|
||||||
t = TimeToDatePart(t, tz)
|
t = TimeToDatePart(t, tz)
|
||||||
|
Loading…
Reference in New Issue
Block a user