Documentation ¶
Index ¶
- Variables
- func AddYears(t time.Time, yearCount float64, tz *time.Location) time.Time
- func CombineDateAndTime(d time.Time, t time.Time) time.Time
- func DaysInMonth(t time.Time) int
- func DurationFromTime(hours int, minutes int, seconds int) time.Duration
- func FloorTime(t time.Time) time.Time
- func FormatNaturalDurationEnglish(iv time.Duration) string
- func FromDays[T langext.NumberConstraint](v T) time.Duration
- func FromHours[T langext.NumberConstraint](v T) time.Duration
- func FromMicroseconds[T langext.NumberConstraint](v T) time.Duration
- func FromMilliseconds[T langext.NumberConstraint](v T) time.Duration
- func FromMinutes[T langext.NumberConstraint](v T) time.Duration
- func FromNanoseconds[T langext.NumberConstraint](v T) time.Duration
- func FromSeconds[T langext.NumberConstraint](v T) time.Duration
- func GetAggregateIsoWeekCount(year int) int
- func GetGlobalWeeknumber(t time.Time) int
- func GetIsoWeekCount(year int) int
- func IsDatePartEqual(a time.Time, b time.Time, tz *time.Location) bool
- func IsSameDayIncludingDateBoundaries(t1 time.Time, t2 time.Time, tz *time.Location) bool
- func IsSunday(t time.Time, tz *time.Location) bool
- func Max(a time.Time, b time.Time) time.Time
- func Min(a time.Time, b time.Time) time.Time
- func MonthDifference(t1 time.Time, t2 time.Time) float64
- func ParseDurationShortString(s string) (time.Duration, error)
- func SubtractYears(t time.Time, yearCount float64, tz *time.Location) time.Time
- func TimeToDatePart(t time.Time, tz *time.Location) time.Time
- func TimeToDayEnd(t time.Time, tz *time.Location) time.Time
- func TimeToDayStart(t time.Time, tz *time.Location) time.Time
- func TimeToMonthEnd(t time.Time, tz *time.Location) time.Time
- func TimeToMonthStart(t time.Time, tz *time.Location) time.Time
- func TimeToNextYearStart(t time.Time, tz *time.Location) time.Time
- func TimeToWeekStart(t time.Time, tz *time.Location) time.Time
- func TimeToYearEnd(t time.Time, tz *time.Location) time.Time
- func TimeToYearStart(t time.Time, tz *time.Location) time.Time
- func UnixFloatSeconds(v float64) time.Time
- func WeekEnd(year, week int) time.Time
- func WeekStart(year, week int) time.Time
- func WeekdayNameGerman(d time.Weekday) string
- func WithTimePart(base time.Time, hour, minute, second int) time.Time
- func YearDifference(t1 time.Time, t2 time.Time, tz *time.Location) float64
- type OpenTimeRange
Constants ¶
This section is empty.
Variables ¶
var TimezoneBerlin *time.Location
Functions ¶
func CombineDateAndTime ¶
CombineDateAndTime returns a timestamp with the date-part (`yyyy`, `MM`, `dd`) from the d parameter and the time (`HH`, `mm`, `ss`) from the t parameter
func DaysInMonth ¶ added in v0.0.509
func FormatNaturalDurationEnglish ¶ added in v0.0.5
func FromMicroseconds ¶ added in v0.0.22
func FromMicroseconds[T langext.NumberConstraint](v T) time.Duration
func FromMilliseconds ¶
func FromMilliseconds[T langext.NumberConstraint](v T) time.Duration
func FromMinutes ¶
func FromMinutes[T langext.NumberConstraint](v T) time.Duration
func FromNanoseconds ¶ added in v0.0.22
func FromNanoseconds[T langext.NumberConstraint](v T) time.Duration
func FromSeconds ¶
func FromSeconds[T langext.NumberConstraint](v T) time.Duration
func GetGlobalWeeknumber ¶
func GetIsoWeekCount ¶
func IsDatePartEqual ¶
IsDatePartEqual returns true if a and b have the same date part (`yyyy`, `MM` and `dd`)
func IsSameDayIncludingDateBoundaries ¶
IsSameDayIncludingDateBoundaries returns true if t1 and t2 are part of the same day (TZ/Berlin), the boundaries of the day are inclusive, this means 2021-09-15T00:00:00 is still part of the day 2021-09-14
func MonthDifference ¶ added in v0.0.509
MonthDifference calculates the difference between two timestamps in months. = t1 - t2 returns a float value
func ParseDurationShortString ¶ added in v0.0.29
ParseDurationShortString parses a duration in string format to a time.Duration Examples for allowed formats:
- '10m'
- '10min'
- '1minute'
- '10minutes'
- '10.5minutes'
- '50s'
- '50sec'
- '1second'
- '50seconds'
- '100ms'
- '100millisseconds'
- '1h'
- '1hour'
- '2hours'
- '1d'
- '1day'
- '10days'
- '1d10m'
- '1d10m200sec'
- '1d:10m'
- '1d 10m'
- '1d,10m'
func SubtractYears ¶ added in v0.0.424
func TimeToDatePart ¶
TimeToDatePart returns a timestamp at the start of the day which contains t (= 00:00:00)
func TimeToDayEnd ¶ added in v0.0.246
TimeToDayEnd returns a timestamp at the end of the day which contains t (= 23:59:59)
func TimeToDayStart ¶ added in v0.0.246
TimeToDayStart returns a timestamp at the start of the day which contains t (= 00:00:00)
func TimeToMonthEnd ¶
TimeToMonthEnd returns a timestamp at the end of the month which contains t (= yyyy-MM-31 23:59:59.999999999)
func TimeToMonthStart ¶
TimeToMonthStart returns a timestamp at the start of the month which contains t (= yyyy-MM-00 00:00:00)
func TimeToNextYearStart ¶ added in v0.0.481
func TimeToWeekStart ¶
TimeToWeekStart returns a timestamp at the start of the week which contains t (= Monday 00:00:00)
func TimeToYearEnd ¶
TimeToYearEnd returns a timestamp at the end of the month which contains t (= yyyy-12-31 23:59:59.999999999)
func TimeToYearStart ¶
TimeToYearStart returns a timestamp at the start of the year which contains t (= yyyy-01-01 00:00:00)
func UnixFloatSeconds ¶
func WeekdayNameGerman ¶
func WithTimePart ¶
WithTimePart returns a timestamp with the date-part (`yyyy`, `MM`, `dd`) from base and the time (`HH`, `mm`, `ss`) from the parameter
Types ¶
type OpenTimeRange ¶
func NewOpenTimeRange ¶
func NewOpenTimeRange(from *time.Time, to *time.Time) *OpenTimeRange
func (*OpenTimeRange) AppendToMongoPipeline ¶
func (r *OpenTimeRange) AppendToMongoPipeline(pipeline []interface{}, key string) []interface{}
func (OpenTimeRange) String ¶
func (r OpenTimeRange) String() string
func (OpenTimeRange) ToMongoPipeline ¶
func (r OpenTimeRange) ToMongoPipeline(key string) []interface{}