bigInt时间转为季度
select (extract(year from TO_TIMESTAMP(1624847261038 / 1000))::text || '.Q' ||
extract(quarter from TO_TIMESTAMP(1624847261038 / 1000))::text) as quarter
结果如下,2021年第二季度.

本文介绍了一种将bigInt类型的时间戳转换为季度格式的方法。通过使用SQL的extract函数配合TO_TIMESTAMP函数,可以准确地从时间戳中提取年份和季度信息,并将其格式化为如'2021.Q2'这样的字符串。
bigInt时间转为季度
select (extract(year from TO_TIMESTAMP(1624847261038 / 1000))::text || '.Q' ||
extract(quarter from TO_TIMESTAMP(1624847261038 / 1000))::text) as quarter
结果如下,2021年第二季度.

6171
1940
2万+

被折叠的 条评论
为什么被折叠?