Reputation: 261
How can I convert a character string to datetime? I need to be able to subtract this character string from an actual date field.
2013-01-01 06:21:31
Upvotes: 0
Views: 81
Reputation: 38345
Use the TO_DATE
function:
TO_DATE(column, 'YYYY-MM-DD HH24:MI:SS')
Or, if it's just a string literal:
TO_DATE('2013-01-01 06:21:31', 'YYYY-MM-DD HH24:MI:SS')
Upvotes: 3