我正在尝试使用以下代码将日期列转换为星期:
select trunc(join_date, 'D') as join_wk from my_table
但是我收到了以下错误:
function trunc(timestamp without time zone, "unknown") does not exist
Hint: No function matches the given name and argument types. You may need to add explicit type casts.
其中join_date
的格式为:
2017-08-24 14:49:59
我在查询中做错了什么?谢谢!
答案 0 :(得分:2)
该函数的名称为date_trunk
,您必须交换参数:
SELECT DATE_TRUNK('D', join_date) AS join_wk FROM my_table