Documentation ¶
Index ¶
- Constants
- func GetFirstDayOfMonth(t time.Time) time.Time
- func GetFirstMondayOfYear(year int) time.Time
- func GetFirstPeriodStartDate(year int) time.Time
- func GetLastDayOfLastPeriod(year int) time.Time
- func GetMondayOfGivenPeriod(t time.Time) time.Time
- func GetPeriodNumber(t time.Time) int
- func GetSundayOfGivenPeriod(t time.Time) time.Time
- func GetTimeOfWeekday(t time.Time, targetWeekday time.Weekday) time.Time
- func IsUTCDate(d time.Time) bool
- func NowWithPrecision(precision time.Duration) time.Time
- func SwapTimezone(date time.Time, timezone string, toUTC bool) (time.Time, error)
Constants ¶
const (
SecondsInDay = 86400
)
Variables ¶
This section is empty.
Functions ¶
func GetFirstDayOfMonth ¶ added in v1.18.3
GetFirstDayOfMonth retrieves the first day of the month for the given date.
func GetFirstMondayOfYear ¶ added in v1.18.3
GetFirstMondayOfYear retrieves the first Monday of the given year.
func GetFirstPeriodStartDate ¶ added in v1.18.5
GetFirstPeriodStartDate retrieves the date of the first day of the first period of a year.
Result will always be a Sunday.
func GetLastDayOfLastPeriod ¶ added in v1.18.5
GetLastDayOfLastPeriod retrieves the last day of the last period of year.
Result will always be a Saturday.
func GetMondayOfGivenPeriod ¶ added in v1.18.3
GetMondayOfGivenPeriod retrieves the Monday of the week the given time.Time object is in.
func GetPeriodNumber ¶ added in v1.18.5
GetPeriodNumber retrieves the period week number for the given date, from 1 trough 53.
func GetSundayOfGivenPeriod ¶ added in v1.18.5
GetSundayOfGivenPeriod retrieves the Sunday of the week the given time.Time object is in.
func GetTimeOfWeekday ¶ added in v1.18.3
GetTimeOfWeekday retrieves the time.Time value of the given weekday within the given time.Time object.
func NowWithPrecision ¶
NewWithPrecision returns a new now time.Time (UTC) with the given precision.
func SwapTimezone ¶ added in v1.18.0
SwapTimezone takes a date (which can be in any timezone) and returns the date in the specified timezone.
The original timezone is overridden by the new timezone.
This method does not perform any timezone conversion. It simply changes the timezone of the date.
If toUTC is true, the returned date is converted to UTC.
Types ¶
This section is empty.