# Wanting to Aggregate Datetimes

**URL:** <https://talk.observablehq.com/t/wanting-to-aggregate-datetimes/7276>\
**Category:** Help\
**Created:** [November 13, 2022, 2:53am UTC](https://talk.observablehq.com/t/wanting-to-aggregate-datetimes/7276 "2022-11-13T02:53:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zachbogart](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/zachbogart/32/8597_2.png) [@zachbogart](https://talk.observablehq.com/u/zachbogart)\
**Post date:** [November 13, 2022, 2:53am UTC](https://talk.observablehq.com/t/wanting-to-aggregate-datetimes/7276/1 "2022-11-13T02:53:57Z")

</div>

[Notebook](https://observablehq.com/d/999c6b2c75ac1a37)

I have a dataset of datetimes and I wanted to see them as a timeseries, counting up how many rows occur in different months/years, etc. When I try this using the rect mark, I end up with many individual marks rather than one big bar for each month. Is this because I have times as well? Do I have to define the year/month in order to aggregate by it?

- If I have datetimes, how can I aggregate them to show arbitrary frequencies in Plot (like number in each month, for example)?

---

<div class="post-metadata">

**Author:** ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)\
**Post date:** [November 13, 2022, 4:05am UTC](https://talk.observablehq.com/t/wanting-to-aggregate-datetimes/7276/2 "2022-11-13T04:05:44Z")

</div>

Try binX instead of groupX. The bin transform is for quantitative or temporal data, while the group transform is for categorical or ordinal data.

---

<div class="post-metadata">

**Author:** ![zachbogart](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/zachbogart/32/8597_2.png) [@zachbogart](https://talk.observablehq.com/u/zachbogart)\
**Post date:** [November 14, 2022, 5:03pm UTC](https://talk.observablehq.com/t/wanting-to-aggregate-datetimes/7276/3 "2022-11-14T17:03:05Z")

</div>

Cool. A comment worth framing. Thanks!

> [@mbostock](#):
>
> Try binX instead of groupX. The bin transform is for quantitative or temporal data, while the group transform is for categorical or ordinal data.
