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:
I don't understand how is 25th Aug less than 19th Aug.
Thanks to everyone, Especially Gordon, Gary. You guys nailed it. When I ran to_CHAR(lastmoddate,'DD-MON-YYYY HH24:MI') I noticed it had 0018 stored in Year. This solved my problem