clickhouse日期类型转为字符类型()

引用:  https://cloud.tencent.com/developer/article/1987036

–字符转日期select ‘2022-01-05 09:58:00’ str,toDate(str),toDateTime(str),toDate(‘2022-01-05’)

–日期转字符select now() dd,toYear(dd) “年”,toQuarter(dd) “季度”,toDayOfMonth(dd) “天”,toDayOfWeek(dd) “星期”,toHour(dd) “时”

select toDate(‘2022-08-05′) dd,formatDateTime(dd,’%Y-%m-%d %H:%M:%S’) “年-月-日 时:分:秒”,formatDateTime(dd,’%Y%m’) “年月”,formatDateTime(dd,’%F’)

————————

引用:  https://cloud.tencent.com/developer/article/1987036

–字符转日期select ‘2022-01-05 09:58:00’ str,toDate(str),toDateTime(str),toDate(‘2022-01-05’)

–日期转字符select now() dd,toYear(dd) “年”,toQuarter(dd) “季度”,toDayOfMonth(dd) “天”,toDayOfWeek(dd) “星期”,toHour(dd) “时”

select toDate(‘2022-08-05′) dd,formatDateTime(dd,’%Y-%m-%d %H:%M:%S’) “年-月-日 时:分:秒”,formatDateTime(dd,’%Y%m’) “年月”,formatDateTime(dd,’%F’)