Documentation
¶
Index ¶
- func AddBusinessDays(t time.Time, days int) time.Time
- func AfterOrEqual(milestone time.Time, date time.Time) booldeprecated
- func Age(birthdate time.Time) int
- func AgeAt(birthdate, at time.Time) int
- func BeforeOrEqual(milestone time.Time, date time.Time) booldeprecated
- func Ceil(t time.Time) time.Time
- func DaysBetween(start, end time.Time) int
- func DaysInMonth(t time.Time) int
- func EndOfDay(t time.Time) time.Time
- func EndOfWeek(t time.Time) time.Time
- func Floor(t time.Time) time.Time
- func GetFirstDayOfMonth() time.Time
- func GetFirstDayOfMonthFor(date time.Time) time.Time
- func GetLastDayOfMonth() time.Time
- func GetLastDayOfMonthFor(date time.Time) time.Time
- func IsSameDay(a, b time.Time) bool
- func IsSameMonth(a, b time.Time) bool
- func IsWeekday(t time.Time) bool
- func IsWeekend(t time.Time) bool
- func MustParseDate(date string) time.Time
- func MustParseDateWithLayout(date string, layout string) time.Time
- func Overlap(start1 time.Time, end1 time.Time, start2 time.Time, end2 time.Time) bool
- func ParseDate(date string, fallback time.Time) time.Time
- func ParseDateWithLayout(date string, layout string, fallback time.Time) time.Time
- func StartOfDay(t time.Time) time.Time
- func StartOfWeek(t time.Time) time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddBusinessDays ¶ added in v1.9.0
AddBusinessDays adds the specified number of business days to the given time. Business days are Monday through Friday, skipping weekends. Negative values subtract business days.
func AgeAt ¶ added in v1.9.0
AgeAt calculates the age in years from the given birthdate to the specified date.
func DaysBetween ¶ added in v1.9.0
DaysBetween returns the number of days between two dates. The result is negative if end is before start.
func DaysInMonth ¶ added in v1.9.0
DaysInMonth returns the number of days in the month of the given time.
func EndOfDay ¶ added in v1.9.0
EndOfDay returns the end of the day (23:59:59.999999999) for the given time in its timezone.
func EndOfWeek ¶ added in v1.9.0
EndOfWeek returns the end of the week (Saturday at 23:59:59.999999999) for the given time.
func GetFirstDayOfMonth ¶ added in v1.9.0
GetFirstDayOfMonth returns the first day of the current month at 00:00:00 in the local timezone.
func GetFirstDayOfMonthFor ¶ added in v1.9.0
GetFirstDayOfMonthFor returns the first day of the month for the given date at 00:00:00 in the date's timezone.
func GetLastDayOfMonth ¶ added in v1.9.0
GetLastDayOfMonth returns the last day of the current month at 23:59:59 in the local timezone.
func GetLastDayOfMonthFor ¶ added in v1.9.0
GetLastDayOfMonthFor returns the last day of the month for the given date at 23:59:59 in the date's timezone.
func IsSameDay ¶ added in v1.9.0
IsSameDay returns true if both times are on the same day (same year, month, and day).
func IsSameMonth ¶ added in v1.9.0
IsSameMonth returns true if both times are in the same month (same year and month).
func IsWeekday ¶ added in v1.9.0
IsWeekday returns true if the given time is on a weekday (Monday through Friday).
func IsWeekend ¶ added in v1.9.0
IsWeekend returns true if the given time is on a weekend (Saturday or Sunday).
func MustParseDate ¶ added in v1.9.0
MustParseDate parses a date string in RFC3339 format. Panics if parsing fails.
func MustParseDateWithLayout ¶ added in v1.9.0
MustParseDateWithLayout parses a date string using the specified layout. Panics if parsing fails.
func ParseDate ¶ added in v1.9.0
ParseDate parses a date string in RFC3339 format. If parsing fails, returns the fallback value.
func ParseDateWithLayout ¶ added in v1.9.0
ParseDateWithLayout parses a date string using the specified layout. If parsing fails, returns the fallback value.
func StartOfDay ¶ added in v1.9.0
StartOfDay returns the start of the day (00:00:00) for the given time in its timezone.
Types ¶
This section is empty.