{"id":21394159,"url":"https://github.com/mchirico/date","last_synced_at":"2025-03-16T14:22:19.662Z","repository":{"id":39633892,"uuid":"147966816","full_name":"mchirico/date","owner":"mchirico","description":"Go Dateparse","archived":false,"fork":false,"pushed_at":"2022-05-30T12:33:52.000Z","size":48,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-23T01:42:21.598Z","etag":null,"topics":["dateparser"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mchirico.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-08T20:15:59.000Z","updated_at":"2022-05-24T00:00:08.000Z","dependencies_parsed_at":"2022-09-20T06:51:46.568Z","dependency_job_id":null,"html_url":"https://github.com/mchirico/date","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchirico%2Fdate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchirico%2Fdate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchirico%2Fdate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchirico%2Fdate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mchirico","download_url":"https://codeload.github.com/mchirico/date/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243878991,"owners_count":20362529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dateparser"],"created_at":"2024-11-22T14:14:33.230Z","updated_at":"2025-03-16T14:22:19.637Z","avatar_url":"https://github.com/mchirico.png","language":"Go","readme":"[![Go](https://github.com/mchirico/date/actions/workflows/go.yml/badge.svg?branch=develop)](https://github.com/mchirico/date/actions/workflows/go.yml)\n\n# date\nGo Dateparse\n\n\n## Install\n\n```bash\ngo get -u github.com/mchirico/date/parse\n\n```\n\n\n### Usage\n\n[playground](https://go.dev/play/p/K0rBJrvVjRn)\n```go\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/mchirico/date/parse\"\n)\n\nfunc main() {\n\n\ts := \"Sep  8  13:24:18 \"\n\ttt, err := parse.DateTimeParse(s).NewYork()\n\tif err != nil {\n\t\tfmt.Printf(\"err: %v\\n\", err)\n\t\treturn\n\t}\n\tfmt.Printf(\"tt: %v\\n\", tt)\n\t// tt: 2018-09-08 13:24:18 -0400 EDT\n\n}\n\n```\n\nHere's another example:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/mchirico/date/parse\"\n)\n\nfunc main() {\n\n\ts := \"1554934858234\"\n\ttt, err := parse.DateTimeParse(s).NewYork()\n\tif err != nil {\n\t\tfmt.Printf(\"err: %v\\n\", err)\n\t\treturn\n\t}\n\tfmt.Printf(\"tt: %v\\n\", tt)\n\t// tt: 2019-04-10 22:20:58.234 -0400 EDT\n\n}\n\n\n```\n\nWorks with timezones \n\n[playground](https://go.dev/play/p/6uPD1gedJNh)\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/mchirico/date/parse\"\n)\n\nfunc main() {\n\n\ts := \"1554934858234\"\n\ttt, err := parse.DateTimeParse(s).TimeIn(\"America/New_York\")\n\tif err != nil {\n\t\tfmt.Printf(\"err: %v\\n\", err)\n\t\treturn\n\t}\n\tfmt.Printf(\"tt: %v\\n\", tt)\n\t// tt: 2019-04-10 18:20:58.234 -0400 EDT\n\n\ttt, _ = parse.DateTimeParse(s).TimeIn(\"America/Chicago\")\n\tfmt.Printf(\"tt: %v\\n\", tt)\n\t// tt: 2019-04-10 17:20:58.234 -0500 CDT\n\n\ttt, _ = parse.DateTimeParse(s).TimeIn(\"America/Detroit\")\n\tfmt.Printf(\"tt: %v\\n\", tt)\n\t// tt: 2019-04-10 18:20:58.234 -0400 EDT\n\n\ttt, _ = parse.DateTimeParse(s).TimeIn(\"America/Denver\")\n\tfmt.Printf(\"tt: %v\\n\", tt)\n\t// tt: 2019-04-10 16:20:58.234 -0600 MDT\n\n\ttt, _ = parse.DateTimeParse(s).TimeIn(\"America/Los_Angeles\")\n\tfmt.Printf(\"tt: %v\\n\", tt)\n\t// tt: 2019-04-10 15:20:58.234 -0700 PDT\n\n\ttt, _ = parse.DateTimeParse(s).TimeIn(\"UTC\")\n\tfmt.Printf(\"tt: %v\\n\", tt)\n\t// tt: 2019-04-10 22:20:58.234 +0000 UTC\n\n\ttt, _ = parse.DateTimeParse(s).TimeIn(\"Asia/Shanghai\")\n\tfmt.Printf(\"tt: %v\\n\", tt)\n\t// tt: 2019-04-11 06:20:58.234 +0800 CST\n\n}\n\n\n```\n\nExample of rounding down.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/mchirico/date/parse\"\n\t\"time\"\n)\n\nfunc main() {\n\n\ts := \"Thu Mar 21 19:07:52 UTC 2019\"\n\ttt, err := parse.DateTimeParse(s).TimeIn(\"America/New_York\")\n\n\tfmt.Printf(\"tt: %s  err: %v\\n\", tt, err)\n\t// tt: 2019-03-21 15:07:52 -0400 EDT  err: \u003cnil\u003e\n\n\tfmt.Printf(\"tt: %s  err: %v\\n\", tt.Round(60*time.Minute), err)\n\t// tt: 2019-03-21 15:00:00 -0400 EDT  err: \u003cnil\u003e\n\n}\n\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmchirico%2Fdate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmchirico%2Fdate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmchirico%2Fdate/lists"}