Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

dateparse

> 编程语言
Open source

GoLang Parse many date strings without knowing format in advance.

2.1K stars0 likes0 views
WebsiteGitHub

About

GoLang Parse many date strings without knowing format in advance.

Go Date Parser

Parse many date strings without knowing format in advance. Uses a scanner to read bytes and use a state machine to find format. Much faster than shotgun based parse methods. See bench_test.go for performance comparison. MM/DD/YYYY VS DD/MM/YYYY Right now this uses mm/dd/yyyy WHEN ambiguous if this is not desired behavior, use ParseStrict which will fail on ambiguous date strings.

Timezones The location your server is configured affects the results! See example or https://play.golang.org/p/IDHRalIyXh and last paragraph here https://golang.org/pkg/time/#Parse.

go

// Normal parse.  Equivalent Timezone rules as time.Parse()
t, err := dateparse.ParseAny("3/1/2014")

// Parse Strict, error on ambigous mm/dd vs dd/mm dates
t, err := dateparse.ParseStrict("3/1/2014")
> returns error 

// Return a string that represents the layout to parse the given date-time.
layout, err := dateparse.ParseFormat("May 8, 2009 5:57:51 PM")
> "Jan 2, 2006 3:04:05 PM"

cli tool for testing dateformats

Date Parse CLI

Extended example

https://github.com/araddon/dateparse/blob/master/example/main.go

…

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Godatedatesdatetimegolang

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言