{"id":16466874,"url":"https://github.com/matriphe/go-format","last_synced_at":"2026-06-03T23:31:08.159Z","repository":{"id":114960406,"uuid":"609955152","full_name":"matriphe/go-format","owner":"matriphe","description":"A helper to format and convert many things in Go.","archived":false,"fork":false,"pushed_at":"2023-03-26T22:04:56.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T02:25:06.610Z","etag":null,"topics":["converter","date","datetime","direction","formatter","time","wind"],"latest_commit_sha":null,"homepage":"","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/matriphe.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,"governance":null}},"created_at":"2023-03-05T18:20:07.000Z","updated_at":"2023-03-26T21:58:12.000Z","dependencies_parsed_at":"2023-09-21T20:15:50.463Z","dependency_job_id":null,"html_url":"https://github.com/matriphe/go-format","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"5a9a8dc33d8275bf5208576c57b64e29323692cf"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/matriphe/go-format","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matriphe%2Fgo-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matriphe%2Fgo-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matriphe%2Fgo-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matriphe%2Fgo-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matriphe","download_url":"https://codeload.github.com/matriphe/go-format/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matriphe%2Fgo-format/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33884733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["converter","date","datetime","direction","formatter","time","wind"],"created_at":"2024-10-11T11:45:04.748Z","updated_at":"2026-06-03T23:31:08.141Z","avatar_url":"https://github.com/matriphe.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Format\n\nA helper to format and convert many things in Go.\n\nI'm fed up with the repetitive formatting of many things, especially the weird Go date format 🙄, so I decided to create a package to not repeat myself.\n\n## Install\n\nAs usual, run: `go get github.com/matriphe/go-format`.\n\n## Usage\n\n### Date and Time\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\t\n\t\"github.com/matriphe/go-format/datetime\"\n)\n\nfunc main()  {\n\ttheTime := time.Date(2023, 3, 5, 18, 45, 21, 0, time.UTC)\n\t\n\tfmt.Println(theTime.Format(datetime.ISODate)) // print '2023-03-05'\n\tfmt.Println(datetime.ToISODate(theTime)) // print '2023-03-05'\n\t_, _ = datetime.FromISODate(\"2023-03-05\") // parse to time.Time\n\n\tfmt.Println(theTime.Format(datetime.ISOTime)) // print '18:45:21'\n\tfmt.Println(datetime.ToISOTime(theTime)) // print '18:45:21'\n\t_, _ = datetime.FromISOTime(\"18:45:21\") // parse to time.Time\n\n\tfmt.Println(theTime.Format(datetime.ISOHourMin)) // print '18:45'\n\tfmt.Println(datetime.ToISOHourMin(theTime)) // print '18:45'\n\t_, _ = datetime.FromISOHourMin(\"18:45\") // parse to time.Time\n\n\tfmt.Println(theTime.Format(datetime.ISODateTime)) // print '2023-03-05 18:45:21'\n\tfmt.Println(datetime.ToISODateTime(theTime)) // print '2023-03-05 18:45:21'\n\t_, _ = datetime.FromISODateTime(\"2023-03-05 18:45:21\") // parse to time.Time\n}\n```\n\n### Wind\n\nThis package converts wind [direction in degree to cardinal directional](http://snowfence.umn.edu/Components/winddirectionanddegrees.htm).\n\nThe reference of this function is from [Stackoverflow](https://stackoverflow.com/a/7490772/3460840).\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\n\t\"github.com/matriphe/go-format/wind\"\n)\n\nfunc main()  {\n\tfmt.Println(wind.Direction(90)) // print 'E'\n\tfmt.Println(wind.Direction(13)) // print 'NNE'\n}\n```\n\n# License\n\nThis package is released under [MIT license](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatriphe%2Fgo-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatriphe%2Fgo-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatriphe%2Fgo-format/lists"}