TO_TIMESTAMP比较
TO_TIMESTAMP Compare
SELECT lastmoddate
, to_timestamp(lastmoddate,'DD-MON-YYYY HH:MI:SS:FF AM')
, cast(current_timestamp - interval '60' day as TIMESTAMP)
FROM table
WHERE primaryKeyColumn = 12141969;
returns:
SELECT problemid
, lastmoddate
, to_timestamp(lastmoddate,'DD-MON-YYYY HH:MI:SS:FF AM')
, cast((current_timestamp - 60) as TIMESTAMP)
FROM table
WHERE primaryKeyColumn = 12141969
and to_timestamp(lastmoddate,'DD-MON-YYYY HH:MI:SS:FF AM') < cast((current_timestamp - 60) as TIMESTAMP);
returns:
我不明白 8 月 25 日怎么比 8 月 19 日少
感谢大家,尤其是 Gordon、Gary。你们搞定了。当我 运行 to_CHAR(lastmoddate,'DD-MON-YYYY HH24:MI') 我注意到它在 Year 中存储了 0018。这解决了我的问题
SELECT lastmoddate
, to_timestamp(lastmoddate,'DD-MON-YYYY HH:MI:SS:FF AM')
, cast(current_timestamp - interval '60' day as TIMESTAMP)
FROM table
WHERE primaryKeyColumn = 12141969;
returns:
SELECT problemid
, lastmoddate
, to_timestamp(lastmoddate,'DD-MON-YYYY HH:MI:SS:FF AM')
, cast((current_timestamp - 60) as TIMESTAMP)
FROM table
WHERE primaryKeyColumn = 12141969
and to_timestamp(lastmoddate,'DD-MON-YYYY HH:MI:SS:FF AM') < cast((current_timestamp - 60) as TIMESTAMP);
returns:
我不明白 8 月 25 日怎么比 8 月 19 日少
感谢大家,尤其是 Gordon、Gary。你们搞定了。当我 运行 to_CHAR(lastmoddate,'DD-MON-YYYY HH24:MI') 我注意到它在 Year 中存储了 0018。这解决了我的问题