{"id":13413250,"url":"https://github.com/vtopc/epoch","last_synced_at":"2026-03-12T00:03:05.607Z","repository":{"id":36667445,"uuid":"228183996","full_name":"vtopc/epoch","owner":"vtopc","description":"Contains primitives for marshaling/unmarshaling Unix timestamp/epoch to/from built-in time.Time type in JSON","archived":false,"fork":false,"pushed_at":"2024-02-25T14:22:45.000Z","size":748,"stargazers_count":14,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-07-30T20:43:28.782Z","etag":null,"topics":["date","deserialization","epoch","epoch-time","go","golang","json","rest","rest-api","rest-client","rest-server","restapi","restful","restful-api","restful-webservices","serialization","time","timestamp","unix-timestamp"],"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/vtopc.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,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-12-15T12:54:37.000Z","updated_at":"2024-02-26T11:39:24.000Z","dependencies_parsed_at":"2024-02-25T15:26:08.390Z","dependency_job_id":"4ba84595-3dab-4f26-bf60-7aadce93e59b","html_url":"https://github.com/vtopc/epoch","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtopc%2Fepoch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtopc%2Fepoch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtopc%2Fepoch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtopc%2Fepoch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vtopc","download_url":"https://codeload.github.com/vtopc/epoch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249509746,"owners_count":21283628,"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":["date","deserialization","epoch","epoch-time","go","golang","json","rest","rest-api","rest-client","rest-server","restapi","restful","restful-api","restful-webservices","serialization","time","timestamp","unix-timestamp"],"created_at":"2024-07-30T20:01:36.094Z","updated_at":"2026-03-12T00:03:04.497Z","avatar_url":"https://github.com/vtopc.png","language":"Go","readme":"[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-single.svg)](https://vshymanskyy.github.io/StandWithUkraine)\n\n# epoch\n\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n[![Godoc Reference][godoc-img]][godoc-url] [![build][build-img]][build-url] \n[![codecov][codecov-img]][codecov-url] [![goreportcard][goreportcard-img]][goreportcard-url]\n\nContains primitives for marshaling/unmarshaling Unix timestamp/epoch to/from built-in time.Time type in JSON.\n\n## Seconds\nSeconds since the Epoch(Unix time), e.g.:\n```json\n  {\"timestamp\":1136239445}\n```\nInherits built-in time.Time type, thus has all it methods, but has custom serializer and\ndeserializer(converts integer into built-in time.Time and vice versa).\n\n#### Usage Example\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/vtopc/epoch\"\n)\n\ntype Request struct {\n\tTimestamp epoch.Seconds `json:\"timestamp\"`\n}\n\nfunc main() {\n\tvar v Request\n\terr := json.Unmarshal([]byte(`{\"timestamp\":1136239445}`), \u0026v)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%+v\\n\", v)\n\t// Output: {Timestamp:2006-01-03 00:04:05 +0200 EET}\n\n\t// Also as epoch.Seconds inherits all time.Time's methods one can do next:\n\tfmt.Println(v.Timestamp.Year())\n\t// Output: 2006\n\tfmt.Println(v.Timestamp.UTC().String())\n\t// Output: 2006-01-02 22:04:05 +0000 UTC\n}\n```\n\n## Milliseconds\nSame as epoch.Seconds, but for Epoch(Unix time) in milliseconds, e.g.:\n```json\n  {\"timestamp\":1136239445999}\n```\n\n## StrSeconds\nSame as epoch.Seconds, but for strings, e.g.:\n```json\n  {\"timestamp\":\"1136239445\"}\n```\n\n## StrMilliseconds\nSame as epoch.Milliseconds, but for strings, e.g.:\n```json\n  {\"timestamp\":\"1136239445999\"}\n```\n\n## FloatMS\nInteger part of timestamp represents seconds and fractional - milliseconds since the Epoch(Unix time), \ne.g.:\n```json\n  {\"timestamp\":1136239445.999}\n```\n\n## Installation\n```shell\ngo get github.com/vtopc/epoch@latest\n```\nThis will update yours go.mod file.\n\n## Additional terms of use for users from russia and Belarus\n\nBy using the code provided in these repositories you agree with the following:\n* russia has [illegally annexed Crimea in 2014](https://en.wikipedia.org/wiki/Annexation_of_Crimea_by_the_Russian_Federation) and [brought the war in Donbas](https://en.wikipedia.org/wiki/War_in_Donbas) followed by [full-scale invasion of Ukraine in 2022](https://en.wikipedia.org/wiki/2022_Russian_invasion_of_Ukraine).\n* russia has brought sorrow and devastations to millions of Ukrainians, killed hundreds of innocent people, damaged thousands of buildings, and forced several million people to flee.\n* [Putin khuylo!](https://en.wikipedia.org/wiki/Putin_khuylo!)\n\nGlory to Ukraine! 🇺🇦\n\n[godoc-img]: https://godoc.org/github.com/vtopc/epoch?status.svg\n[godoc-url]: https://godoc.org/github.com/vtopc/epoch\n\n[build-img]: https://github.com/vtopc/epoch/workflows/build/badge.svg\n[build-url]: https://github.com/vtopc/epoch/actions?query=workflow%3A%22build%22\n\n[codecov-img]: https://codecov.io/gh/vtopc/epoch/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/vtopc/epoch\n\n[goreportcard-img]: https://goreportcard.com/badge/github.com/vtopc/epoch\n[goreportcard-url]: https://goreportcard.com/report/github.com/vtopc/epoch\n","funding_links":[],"categories":["JSON","Relational Databases"],"sub_categories":["Search and Analytic Databases","检索及分析资料库","SQL 查询语句构建库","Advanced Console UIs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvtopc%2Fepoch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvtopc%2Fepoch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvtopc%2Fepoch/lists"}