Skip to content
Advertisement

concatenate timestamp to date

I have set of timestamps:

2020-12-07 21:00:00+00
2020-12-07 22:00:00+00
2020-12-07 23:00:00+00
2020-12-07 00:00:00+00
2020-12-06 01:00:00+00
2020-12-06 02:00:00+00

how I can concatenate it to dates? expected:

2020-12-07
2020-12-06

Advertisement

Answer

You would cast it to a date and the use distinct to get the distinct dates

select distinct the_column::date
from the_table
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement