All Projects β†’ metakeule β†’ fmtdate

metakeule / fmtdate

Licence: other
MS Excel (TM) syntax for Go time/date

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to fmtdate

Date Picker
πŸ“… Custom responsive date picker widget for Android, written in Kotlin.
Stars: ✭ 146 (+53.68%)
Mutual labels:  datetime, date
lit-date
Light-weight, faster datetime formatter for modern browsers.
Stars: ✭ 33 (-65.26%)
Mutual labels:  datetime, date
Gostradamus
Gostradamus: Better DateTimes for Go πŸ•°οΈ
Stars: ✭ 148 (+55.79%)
Mutual labels:  datetime, date
ptera
Ptera is DateTime library for Deno
Stars: ✭ 62 (-34.74%)
Mutual labels:  datetime, date
Jest Date Mock
πŸŒ— Mock `Date` when run unit test cases with jest. Make tests of Date easier.
Stars: ✭ 224 (+135.79%)
Mutual labels:  datetime, date
Delorean
Delorean: Time Travel Made Easy
Stars: ✭ 1,793 (+1787.37%)
Mutual labels:  datetime, date
Date
A date and time library based on the C++11/14/17 <chrono> header
Stars: ✭ 2,389 (+2414.74%)
Mutual labels:  datetime, date
Calendar
πŸ“… PHP Date & Time library that solves common problems in object oriented, immutable way.
Stars: ✭ 113 (+18.95%)
Mutual labels:  datetime, date
iso8601
A fast ISO8601 date parser for Go
Stars: ✭ 122 (+28.42%)
Mutual labels:  datetime, date
Go Naturaldate
Natural date/time parsing for Go.
Stars: ✭ 217 (+128.42%)
Mutual labels:  datetime, date
Tail.datetime
A lightweight, translat- and configurable Open Source DateTime Picker, written in pure vanilla JavaScript!
Stars: ✭ 139 (+46.32%)
Mutual labels:  datetime, date
Jiffy
Jiffy is a Flutter (Android, IOS and Web) date time package inspired by momentjs for parsing, manipulating, querying and formatting dates
Stars: ✭ 238 (+150.53%)
Mutual labels:  datetime, date
Anytime
Anything to POSIXct or Date Converter
Stars: ✭ 137 (+44.21%)
Mutual labels:  datetime, date
Masuit.tools
ldqk.xyz/55
Stars: ✭ 2,539 (+2572.63%)
Mutual labels:  datetime, excel
Horizontalpicker
DatePicker horizontal con selecciΓ³n smooth por dΓ­a para Android.
Stars: ✭ 116 (+22.11%)
Mutual labels:  datetime, date
Time
Building a better date/time library for Swift
Stars: ✭ 1,983 (+1987.37%)
Mutual labels:  datetime, date
Dateparse
GoLang Parse many date strings without knowing format in advance.
Stars: ✭ 1,365 (+1336.84%)
Mutual labels:  datetime, date
Time Stamp
Get a formatted timestamp. Used in gulp, assemble, generate, and many others.
Stars: ✭ 104 (+9.47%)
Mutual labels:  datetime, date
Dpicker
A framework-agnostic minimal date picker
Stars: ✭ 187 (+96.84%)
Mutual labels:  datetime, date
Flatpickr
lightweight, powerful javascript datetimepicker with no dependencies
Stars: ✭ 14,575 (+15242.11%)
Mutual labels:  datetime, date

fmtdate

Note: If you are reading this on Github, please note that the repo has moved to Gitlab (gitlab.com/metakeule/fmtdate) and this is only a mirror.

100% test coverage (that was easy :-))

fmtdate provides a date formatter and parser using the syntax of Microsoft Excel (TM).

Additionally it offers default conversions for date time and datetime.

Why?

Microsoft Excel (TM) has a well known syntax for date formatting, that more memorable than the syntax chosen in the time package in the go library.

Usage

	package main
	import (
		"gitlab.com/metakeule/fmtdate"
		"fmt"
	)

	func main() {
		date := fmtdate.Format("DD.MM.YYYY", time.Now())
		fmt.Println(date)

		var err
		date, err = fmtdate.Parse("M/D/YY", "2/3/07")
		fmt.Println(date, err)
	}

For json

    package main

    import (
        "gitlab.com/metakeule/fmtdate"
        "fmt"
        "encoding/json"
    )

    type Person struct {
        Name string
        BirthDay fmtdate.TimeDate
    }

    func main() {
        bday, err := fmtdate.NewTimeDate("YYYY-MM-DD", "2000-12-04")
        // do error handling
        paul := &Person{"Paul", bday}

        data, err := json.Marshal(paul)
        // do error handling
    }

Placeholders

M    - month (1)
MM   - month (01)
MMM  - month (Jan)
MMMM - month (January)
D    - day (2)
DD   - day (02)
DDD  - day (Mon)
DDDD - day (Monday)
YY   - year (06)
YYYY - year (2006)
hh   - hours (15)
mm   - minutes (04)
ss   - seconds (05)

AM/PM hours: 'h' followed by optional 'mm' and 'ss' followed by 'pm', e.g.

hpm        - hours (03PM)
h:mmpm     - hours:minutes (03:04PM)
h:mm:sspm  - hours:minutes:seconds (03:04:05PM)

Time zones: a time format followed by 'ZZZZ', 'ZZZ' or 'ZZ', e.g.

hh:mm:ss ZZZZ (16:05:06 +0100)
hh:mm:ss ZZZ  (16:05:06 CET)
hh:mm:ss ZZ   (16:05:06 +01:00)

Documentation

see https://pkg.go.dev/gitlab.com/metakeule/fmtdate

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].