---
title: How do I extract a list of distinct dates from a table?
---

_I have a table with a date column that contains many repeated dates. How can I get a list of the unique dates?_

Use [`selectDistinct`](../table-operations/select/select-distinct.md) to get the unique dates, then extract them into a list:

```groovy test-set=dates order=source,distinctDates
import static io.deephaven.time.DateTimeUtils.parseInstant

// Sample table with many rows and repeated dates across multiple timestamps
startDate = parseInstant("2024-01-15T09:00:00 ET")

source = emptyTable(50).update(
    "Timestamp = startDate + (long)(i * HOUR)",
    "Date = toLocalDate(Timestamp, 'ET')",
    "Value = randomDouble(100.0, 500.0)"
)

// Get distinct dates - reduces 50 rows to just the unique dates
distinctDates = source.selectDistinct("Date")
```

Then extract the dates into a list using [`ColumnVectors`](../../how-to-guides/extract-table-value.md):

```groovy test-set=dates
import io.deephaven.engine.table.vectors.ColumnVectors

dateList = ColumnVectors.ofObject(distinctDates, "Date", java.time.LocalDate.class).toArray() as List
println dateList
```

This approach works for any column type, not just dates. Use `selectDistinct` to get unique values from any column in your table.

> [!NOTE]
> These FAQ pages contain answers to questions about Deephaven Community Core that our users have asked in our [Community Slack](/slack). If you have a question that is not in our documentation, [join our Community](/slack) and we'll be happy to help!
