在没有 00:00:00 的情况下将时间戳转换为月份

Converting Timestamp to Month without the 00:00:00

我的时间戳如下所示:

2022-01-2303:50:48

我希望它看起来像这样:

2022-01-01

但是,目前看起来是这样的:

2022-01-0100:00:00

我的SQL逻辑: , DATE_TRUNC('month', DATE(timestamp)) as reporting_month

有没有办法让它看起来像月份和年份?

使用date_format格式化日期值:

select date_format(now(), '%Y-%m-%d')
_col0
2022-04-27

或将时间戳转换为日期:

select date(now())