Early Access: The content on this website is provided for informational purposes only in connection with pre-General Availability Qlik Products. All content is subject to change and is provided without warranty.
以下示例使用 1983-12-14T13:15:30Z 作为时间戳数据来显示不同 SET TimestampFormat 语句的结果。所用的日期格式为 YYYYMMDD 并且时间格式为 h:mm:ss TT。日期格式已经在数据加载脚本顶部的 SET DateFormat 语句中指定,并且时间格式在 SET TimeFormat 语句中指定。
结果
示例
结果
SET TimestampFormat='YYYYMMDD';
19831214
SET TimestampFormat='M/D/YY hh:mm:ss[.fff]';
12/14/83 13:15:30
SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';
14/12/1983 13:15:30
SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff] TT';
14/12/1983 1:15:30 PM
SET TimestampFormat='YYYY-MM-DD hh:mm:ss[.fff] TT';
1983-12-14 01:15:30
示例:加载脚本
在第一个加载脚本中使用了 SET TimestampFormat='DD/MM/YYYY h:mm:ss[.fff] TT'。在第二个加载脚本中,时间戳格式更改为 SET TimestampFormat='MM/DD/YYYY hh:mm:ss[.fff]'。不同的结果示出 SET TimeFormat 语句如何用于不同的时间数据格式。
下面的表格示出用在所遵照的加载脚本中的数据集。表格的第二列示出数据集中每个时间戳的格式。前五个时间戳遵照 ISO 8601 规则但是第六个没有。