Date and Time

25 projects

Go's time package covers more than many developers expect: monotonic clock readings for measuring elapsed time, time zones loaded from the system or embedded with the time/tzdata package, durations, and formatting through a reference layout (Mon Jan 2 15:04:05 MST 2006) rather than strftime codes. The libraries here add conveniences on top: parsing unknown formats, calendar arithmetic, human-readable durations, natural language input and regional calendars.

dromara/carbon, modeled on PHP's Carbon, offers a large set of helpers for comparisons, period boundaries and formatting. jinzhu/now is smaller and focuses on the start and end of days, weeks and months. araddon/dateparse guesses the layout of dates in unknown formats, though it has been quiet since 2023. relvacode/iso8601 parses ISO 8601 quickly, durafmt and go-str2duration format and parse durations, and go-anytime understands phrases like "next Friday at 3pm". There are also packages for the Persian calendar, German public holidays and sunrise and sunset times.

Use the standard library for storage and arithmetic, and keep times in UTC with an explicit location for display. Add a helper library when you repeatedly compute calendar boundaries or accept free-form user input. Be careful with libraries that guess formats: ambiguous inputs like 01/02/2006 can be read as January or February.

carbonby dromara

A simple, semantic and developer-friendly time package for golang.

github.com/dromara/carbon/v2Go 1.18+ 1 dependencyv2.7.0updated 4d ago

5.2k

nowby jinzhu

Now is a time toolkit for golang.

github.com/jinzhu/nowGo 1.12+ No dependencies updated 9mo ago

4.7k

dateparseby araddon

Parse date's without knowing format in advance.

github.com/araddon/dateparseGo 1.12+ 2 dependenciesupdated 2y ago

2.1k

carbonby uniplaces

Simple Time extension with a lot of util methods, ported from PHP Carbon library.

github.com/uniplaces/carbonGo 1.16+ 1 dependencyv0.2.2updated 2y ago

780

durafmtby hako

Time duration formatting library for Go.

github.com/hako/durafmtGo 1.11+ No dependencies updated 5y ago

511

go-persian-calendarby yaa110

The implementation of the Persian (Solar Hijri) Calendar in Go (golang).

github.com/yaa110/go-persian-calendarGo 1.20+ No dependencies v1.3.0updated 1y ago

244

gostradamusby bykof

A Go package for working with dates.

github.com/bykof/gostradamusGo 1.22+ 2 dependenciesupdated 1y ago

208

timeutilby leekchan

Useful extensions (Timedelta, Strftime,...) to the golang's time package.

updated 7y ago

193

go-sunriseby nathan-osman

Calculate the sunrise and sunset times for a given location.

github.com/nathan-osman/go-sunriseGo 1.13+ No dependencies updated 2y ago

178

iso8601by relvacode

Efficiently parse ISO8601 date-times without regex.

github.com/relvacode/iso8601Go 1.13+ No dependencies v1.8.3updated 4d ago

170

dateby rickb777

Augments Time for working with dates, date ranges, time spans, periods, and time-of-day.

github.com/rickb777/date/v2Go 1.26+ 4 dependenciesv2.5.1updated 10d ago

142

go-str2durationby xhit

Convert string to duration. Support time.Duration returned string and more.

github.com/xhit/go-str2duration/v2Go 1.13+ No dependencies v2.2.0updated 1mo ago

123

timespanby SaidinWoT

For interacting with intervals of time, defined as a start time and a duration.

updated 7y ago

84

feiertageby wlbr

Set of functions to calculate public holidays in Germany, incl. specialization on the states of Germany (Bundesländer). Things like Easter, Pentecost, Thanksgiving.

github.com/wlbr/feiertageGo 1.25+ No dependencies v1.20.1updated 5mo ago

55

go-anytimeby ijt

Parse dates/times like "next dec 22nd at 3pm" and ranges like "from today until next thursday" without knowing the format in advance.

github.com/ijt/go-anytimeGo 1.19+ 2 dependenciesv2.1.1updated 1mo ago

36

kairby GuilhermeCaruso

Date and Time - Golang Formatting Library.

updated 6y ago

24

timexby invzhi

A Go package that extends the standard library time with dedicated date and time-of-day types.

github.com/invzhi/timexGo 1.20+ 1 dependencyv1.1.1updated 6d ago

22

approxby goschtalt

A Duration extension supporting parsing/printing durations in days, weeks and years.

github.com/goschtalt/approxGo 1.18+ No dependencies v1.0.0updated 4mo ago

19

cronrangeby 1set

Parses Cron-style time range expressions, checks if the given time is within any ranges.

github.com/1set/cronrangeGo 1.13+ 1 dependencyupdated 4y ago

18

strftimeby awoodbeck

C99-compatible strftime formatter.

updated 8y ago

14

tuesdayby osteele

Ruby-compatible Strftime function.

github.com/osteele/tuesdayGo 1.25+ No dependencies v1.1.1updated 2mo ago

14

go-weekby stoewer

An efficient package to work with ISO8601 week dates.

github.com/stoewer/go-weekGo 1.11+ 4 dependenciesupdated 4y ago

11

go-date-fnsby chmenegatti

A comprehensive date utility library for Go, inspired by date-fns, with 140+ pure and immutable functions.

github.com/chmenegatti/go-date-fnsGo 1.24+ No dependencies v0.1.1updated 8mo ago

6

go-datebinby deatil

A simple datetime parse pkg.

github.com/deatil/go-datebinGo 1.25+ No dependencies v1.0.2000updated 4mo ago

5

go-faketimeby harkaitz

A simple time.Now() that honors the faketime(1) utility.

github.com/harkaitz/go-faketimeGo 1.21+ No dependencies updated 1y ago

5
Esc

Type to search every entry. ↑↓ to move, Enter to open.