# How to group by date only in data explorer

**URL:** <https://meta.discourse.org/t/how-to-group-by-date-only-in-data-explorer/92868>\
**Category:** Data & reporting\
**Tags:** sql-query\
**Created:** [7월 22, 2018, 4:45오전 UTC](https://meta.discourse.org/t/how-to-group-by-date-only-in-data-explorer/92868 "2018-07-22T04:45:17Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [7월 22, 2018, 5:41오전 UTC](https://meta.discourse.org/t/how-to-group-by-date-only-in-data-explorer/92868/5 "2018-07-22T05:41:29Z")

</div>

I think `date_trunc` could work

> **[9.9. Date/Time Functions and Operators](https://www.postgresql.org/docs/9.1/functions-datetime.html)**
>
> 9.9. Date/Time Functions and Operators # 9.9.1. EXTRACT, date\_part 9.9.2. date\_trunc 9.9.3. date\_bin 9.9.4. AT TIME ZONE and AT LOCAL 9.9.5. …

examples (note the right padded zeroes and oh-ones)

> Examples:
> 
> SELECT date\_trunc(‘hour’, TIMESTAMP ‘2001-02-16 20:38:40’); _Result:_ 2001-02-16 20:00:00  
> SELECT date\_trunc(‘year’, TIMESTAMP ‘2001-02-16 20:38:40’); _Result:_ 2001-01-01 00:00:00

---

_[View the full topic](https://meta.discourse.org/t/how-to-group-by-date-only-in-data-explorer/92868)._
