使用 date_format 在数据块中进行时间戳转换
timestamp conversion in databricks using date_format
我想在数据块中转换以下时间戳,请帮助获得所需的格式
select date_format(from_utc_timestamp(current_timestamp,'America/Los_Angeles'), 'MM/DD/YY HH24:MI') AS START_TIME
错误:
IllegalArgumentException: All week-based patterns are unsupported since Spark 3.0, detected: Y,
您收到的错误消息:
IllegalArgumentException: ......, detected: Y,
... for instance dd.MM.yyyy and could return a string like ‘18.03.1993’. All pattern letters of datetime pattern can be used.
datetime pattern 列出有效符号。 Y
不是有效符号。请改用 y
。
它还说:
Year: The count of letters determines the minimum field width below which padding is used. If the count of letters is two, then a reduced two digit form is used. For printing, this outputs the rightmost two digits....
所以 yyyy
会给你 2022
而 yy
会给你 22
.
我想在数据块中转换以下时间戳,请帮助获得所需的格式
select date_format(from_utc_timestamp(current_timestamp,'America/Los_Angeles'), 'MM/DD/YY HH24:MI') AS START_TIME
错误:
IllegalArgumentException: All week-based patterns are unsupported since Spark 3.0, detected: Y,
您收到的错误消息:
IllegalArgumentException: ......, detected: Y,
... for instance dd.MM.yyyy and could return a string like ‘18.03.1993’. All pattern letters of datetime pattern can be used.
datetime pattern 列出有效符号。 Y
不是有效符号。请改用 y
。
它还说:
Year: The count of letters determines the minimum field width below which padding is used. If the count of letters is two, then a reduced two digit form is used. For printing, this outputs the rightmost two digits....
所以 yyyy
会给你 2022
而 yy
会给你 22
.