此函数用于输入 timestamp、month 和 year ,并使用在输入中指定的 year 和 month 更新 timestamp 。 .
Syntax:
SetDateYearMonth (timestamp, year, month)
Return data type: 双
Arguments:
参数 | 说明 |
---|---|
timestamp | 标准的 Qlik Sense 时间戳(通常只是一个日期)。 |
year | 一个四位数年份。 |
month | 一位或两位数月份。 |
以下示例使用日期格式 DD/MM/YYYY。日期格式已经在数据加载脚本顶部的 SET DateFormat 语句中指定。可以根据要求更改示例中的格式。
示例 | 结果 | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
setdateyearmonth ('29/10/2005', 2013, 3) | 返回“ |
||||||||||||||||||||||||
setdateyearmonth ('29/10/2005 04:26:14', 2013, 3) | 返回“ 要在可视化中查看时间戳的时间部分,您必须将数字格式设置为日期,并选择用于显示时间值的格式的值。 |
||||||||||||||||||||||||
将示例脚本添加到应用程序并运行。然后,至少要将结果列中列出的字段添加到应用程序中的表格才能查看结果。 SetYearMonth: Load *, SetDateYearMonth(testdates, 2013,3) as NewYearMonth Inline [ testdates 1/11/2012 10/12/2012 2/1/2013 19/5/2013 15/9/2013 11/12/2013 14/5/2014 13/6/2014 7/7/2014 4/8/2014 ]; |
|