Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何从 Amazon redshift 中的 20200211000000 和 20200211001820 中获取 Datediff 作为查看数据,我们可以说有 3 分钟的差异如何使用查询来实现
SELECT DATEDIFF(minute,TO_TIMESTAMP('20200211000000','YYYYMMDDHH24MISS')::TIMESTAMP,TO_TIMESTAMP('20200211001820','YYYYMMDDHH24MISS')::TIMESTAMP);
上面的查询首先将字符串格式化为一个TIMESTAMPTZ值,然后将其转换TIMESTAMP为DATEDIFF函数只接受TIMESTAMP值作为参数。
TIMESTAMPTZ
TIMESTAMP
DATEDIFF