Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Truncate Impala:内置函数trunc()的返回日_Truncate_Impala_Built In - Fatal编程技术网

Truncate Impala:内置函数trunc()的返回日

Truncate Impala:内置函数trunc()的返回日,truncate,impala,built-in,Truncate,Impala,Built In,当我使用trunc(timestamp'D')时,它总是给我该周的星期一。是否可以要求函数返回一周中的其他日期,例如星期二?谢谢 您应该使用trunc(时间戳'J')。请参阅文档了解日期,您使用的是“一周的开始日期”: trunc(timestamp, string unit) Purpose: Strips off fields from a TIMESTAMP value. Unit argument: The unit argument value is case-sensitive. T

当我使用trunc(timestamp'D')时,它总是给我该周的星期一。是否可以要求函数返回一周中的其他日期,例如星期二?谢谢

您应该使用
trunc(时间戳'J')
。请参阅文档了解日期,您使用的是“一周的开始日期”:

trunc(timestamp, string unit)
Purpose: Strips off fields from a TIMESTAMP value.
Unit argument: The unit argument value is case-sensitive. This argument string can be one of:
SYYYY, YYYY, YEAR, SYEAR, YYY, YY, Y: Year.
Q: Quarter.
MONTH, MON, MM, RM: Month.
WW, W: Same day of the week as the first day of the month.
DDD, DD, J: Day.
DAY, DY, D: Starting day of the week. (Not necessarily the current day.)
HH, HH12, HH24: Hour. A TIMESTAMP value truncated to the hour is always represented in 24-hour notation, even for the HH12 argument string.
MI: Minute.
简单,试试看 选择TRUNC(时间戳'D')+间隔1天