Zornjac
Zornjac

Reputation: 261

Convert character string to a Datetime

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

Answers (1)

Anthony Grist
Anthony Grist

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

Related Questions