https://github.com/stefanov-sm/postgresql-date_bucket
PostgreSQL implementation of SQL-standard date_bucket() function
https://github.com/stefanov-sm/postgresql-date_bucket
Last synced: about 1 month ago
JSON representation
PostgreSQL implementation of SQL-standard date_bucket() function
- Host: GitHub
- URL: https://github.com/stefanov-sm/postgresql-date_bucket
- Owner: stefanov-sm
- License: mit
- Created: 2023-10-11T06:13:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-11T17:23:17.000Z (over 1 year ago)
- Last Synced: 2025-02-15T23:42:25.403Z (3 months ago)
- Language: PLpgSQL
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PostgreSQL-date_bucket
PostgreSQL implementation of SQL-standard `date_bucket()` functionSignature
```sql
function date_bucket(dpart text, dpart_count integer, ts timestamptz, origin timestamptz default 'epoch')
returns timestamptz;
```
Example
```sql
select current_timestamp, date_bucket('seconds', 10, current_timestamp);
```
|current_timestamp |date_bucket |
|-----------------------------|-----------------------------|
|2023-10-11 09:14:52.925 +0300|2023-10-11 09:14:50.000 +0300|