提取函数将返回一个星期数,例如
select extract(week from jobstarttimeiso) as weeknumber
一般:
EXTRACT ( datepart FROM { TIMESTAMP 'literal' | timestamp } )
参见:https://docs.aws.amazon.com/redshift/latest/dg/r_EXTRACT_function.html
或者,您也可以使用to_char()
TO_CHAR (timestamp_expression | numeric_expression , 'format')
使用参数IYYY
作为ISO 8601周编号年份的格式(4个或更多数字)