{"id":18382617,"url":"https://github.com/stefanov-sm/pre-pg14-date_bin-function","last_synced_at":"2025-04-11T21:26:11.510Z","repository":{"id":146063686,"uuid":"401787698","full_name":"stefanov-sm/Pre-PG14-date_bin-function","owner":"stefanov-sm","description":"Postgresql date_bin for versions prior to 14. Can be used for running interval aggregation in time series data scenarios.","archived":false,"fork":false,"pushed_at":"2022-06-23T13:32:24.000Z","size":31,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-15T23:42:24.882Z","etag":null,"topics":["postgresql","sql"],"latest_commit_sha":null,"homepage":"","language":"PLpgSQL","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/stefanov-sm.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,"publiccode":null,"codemeta":null}},"created_at":"2021-08-31T17:24:49.000Z","updated_at":"2022-06-02T13:28:00.000Z","dependencies_parsed_at":"2023-04-08T02:16:55.996Z","dependency_job_id":null,"html_url":"https://github.com/stefanov-sm/Pre-PG14-date_bin-function","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanov-sm%2FPre-PG14-date_bin-function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanov-sm%2FPre-PG14-date_bin-function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanov-sm%2FPre-PG14-date_bin-function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanov-sm%2FPre-PG14-date_bin-function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefanov-sm","download_url":"https://codeload.github.com/stefanov-sm/Pre-PG14-date_bin-function/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248481877,"owners_count":21111233,"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":["postgresql","sql"],"created_at":"2024-11-06T01:07:06.369Z","updated_at":"2025-04-11T21:26:11.478Z","avatar_url":"https://github.com/stefanov-sm.png","language":"PLpgSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Postgresql date_bin function for versions prior to PG14  \n#### Postgresql `date_trunc` by interval. Can be used for running interval aggregation in time series data scenarios. \n```sql\nfunction date_bin(trunc_period interval, ts timestamptz, base_ts timestamptz default 'epoch')\nreturns timestamptz;\n```\n#### Demo\n```sql\nselect now(), date_bin(interval '10 seconds', now());\n```\nyields  \n2021-09-13 23:18:**27.256826**, 2021-09-13 23:18:**20.0**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanov-sm%2Fpre-pg14-date_bin-function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefanov-sm%2Fpre-pg14-date_bin-function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanov-sm%2Fpre-pg14-date_bin-function/lists"}