date_utils

package
v0.6.80 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDays

func AddDays(t time.Time, days int) time.Time

AddDays adds the specified number of days to the date.

func AddMonths

func AddMonths(t time.Time, months int) time.Time

AddMonths adds the specified number of months to the date.

func AddYears

func AddYears(t time.Time, years int) time.Time

AddYears adds the specified number of years to the date.

func DaysBetween

func DaysBetween(t1, t2 time.Time) int

DaysBetween calculates the difference in days between two dates.

func DaysInMonth

func DaysInMonth(year int, month time.Month) int

DaysInMonth returns the number of days in the specified month of the specified year.

func FormatDate

func FormatDate(t time.Time, layout string) string

FormatDate formats the date to "YYYY-MM-DD" by default, or uses a custom layout if provided.

func IsWeekend

func IsWeekend(t time.Time) bool

IsWeekend checks if the given date is a Saturday or Sunday.

func ParseDate

func ParseDate(dateStr, layout string) (time.Time, error)

ParseDate parses a date string with a specified layout, or "YYYY-MM-DD" by default.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL