{"id":16657424,"url":"https://github.com/whatyouhide/ecto_unix_timestamp","last_synced_at":"2025-07-06T11:32:44.134Z","repository":{"id":212261107,"uuid":"730786202","full_name":"whatyouhide/ecto_unix_timestamp","owner":"whatyouhide","description":"Ecto type for datetimes stored and cast as Unix timestamps. 🕰️","archived":false,"fork":false,"pushed_at":"2024-12-22T17:40:16.000Z","size":33,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-09T05:32:03.270Z","etag":null,"topics":["ecto","ecto-extension","ecto-types","elixir","elixir-ecto","elixir-lang","elixir-library"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/whatyouhide.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","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,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"whatyouhide"}},"created_at":"2023-12-12T17:06:32.000Z","updated_at":"2025-03-19T20:10:35.000Z","dependencies_parsed_at":"2023-12-13T10:50:48.563Z","dependency_job_id":"37db1246-efb4-4dbe-a50b-aa4c8a5094ea","html_url":"https://github.com/whatyouhide/ecto_unix_timestamp","commit_stats":null,"previous_names":["whatyouhide/ecto_unix_timestamp"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/whatyouhide/ecto_unix_timestamp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatyouhide%2Fecto_unix_timestamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatyouhide%2Fecto_unix_timestamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatyouhide%2Fecto_unix_timestamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatyouhide%2Fecto_unix_timestamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whatyouhide","download_url":"https://codeload.github.com/whatyouhide/ecto_unix_timestamp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatyouhide%2Fecto_unix_timestamp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263893144,"owners_count":23526226,"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":["ecto","ecto-extension","ecto-types","elixir","elixir-ecto","elixir-lang","elixir-library"],"created_at":"2024-10-12T10:00:31.084Z","updated_at":"2025-07-06T11:32:44.115Z","avatar_url":"https://github.com/whatyouhide.png","language":"Elixir","funding_links":["https://github.com/sponsors/whatyouhide"],"categories":[],"sub_categories":[],"readme":"# EctoUnixTimestamp\n\n[![hex.pm badge](https://img.shields.io/badge/Package%20on%20hex.pm-informational)](https://hex.pm/packages/ecto_unix_timestamp)\n[![Documentation badge](https://img.shields.io/badge/Documentation-ff69b4)][docs]\n[![CI](https://github.com/whatyouhide/ecto_unix_timestamp/actions/workflows/main.yml/badge.svg)](https://github.com/whatyouhide/ecto_unix_timestamp/actions/workflows/main.yml)\n[![Coverage Status](https://coveralls.io/repos/github/whatyouhide/ecto_unix_timestamp/badge.svg?branch=main)](https://coveralls.io/github/whatyouhide/ecto_unix_timestamp?branch=main)\n\nA nimble Elixir library that provides a [`Ecto.Type`][ecto-type] for fields that come in as [**Unix timestamps**][unix-timestamp].\n\n## Installation\n\n```elixir\ndefp deps do\n  [\n    # ...,\n    {:ecto_unix_timestamp, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Usage\n\nUse this Ecto type in your schemas. You'll have to choose the **precision** of the Unix\ntimestamp, and the underlying database data type you want to *store* the data as.\n\n```elixir\ndefmodule User do\n  use Ecto.Schema\n\n  schema \"users\" do\n    field :created_at, EctoUnixTimestamp, unit: :second, underlying_type: :utc_datetime\n  end\nend\n```\n\nOnce you have this, you can cast Unix timestamps:\n\n```elixir\nimport Ecto.Changeset\n\nchangeset = cast(%User{}, %{created_at: 1672563600}, [:created_at])\n\nfetch_field!(changeset, :created_at)\n#=\u003e ~U[2023-01-01 09:00:00Z]\n```\n\n## License\n\nReleased under the MIT license. See the [license file](LICENSE.txt).\n\n[unix-timestamp]: https://en.wikipedia.org/wiki/Unix_time\n[ecto-type]: https://hexdocs.pm/ecto/Ecto.Type.html\n[docs]: https://hexdocs.pm/ecto_unix_timestamp\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhatyouhide%2Fecto_unix_timestamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhatyouhide%2Fecto_unix_timestamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhatyouhide%2Fecto_unix_timestamp/lists"}