date

package
v1.106.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: AGPL-3.0 Imports: 2 Imported by: 1

Documentation

Overview

Package date contains various date-related utilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DayBoundary

func DayBoundary(t time.Time) (time.Time, time.Time)

DayBoundary returns start and end of the provided day.

func MonthBoundary

func MonthBoundary(t time.Time) (time.Time, time.Time)

MonthBoundary extract month from the provided date and returns its edges.

func MonthsBetweenDates added in v1.6.1

func MonthsBetweenDates(from time.Time, to time.Time) int

MonthsBetweenDates calculates amount of months between two dates.

func MonthsCountSince added in v1.3.2

func MonthsCountSince(from time.Time) int

MonthsCountSince calculates the months between now and the createdAtTime time.Time value passed.

func PeriodToTime added in v1.1.1

func PeriodToTime(period string) (_ time.Time, err error)

PeriodToTime returns time.Time period in format YYYY-MM from string.

func TruncateToHourInNano added in v1.8.1

func TruncateToHourInNano(t time.Time) int64

TruncateToHourInNano returns the time truncated to the hour in nanoseconds.

func UTCBeginOfMonth added in v1.44.1

func UTCBeginOfMonth(now time.Time) time.Time

UTCBeginOfMonth returns utc begin of month (f.e. to get first day in month at 00h00m).

func UTCEndOfMonth added in v1.22.1

func UTCEndOfMonth(now time.Time) time.Time

UTCEndOfMonth returns utc end of month (f.e. to get last day in month).

Types

This section is empty.

Jump to

Keyboard shortcuts

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