Frage

I have a varchar column and I want to convert yyyy-mm-dd hh:mi:ss into mm-dd-yyyy hh:mi:ss and cast it into a date. How can it be done?

War es hilfreich?

Lösung

To convert the string into a date:

to_date (the_string, 'yyyy-mm-dd hh:mi:ss')

If you then want that to be formatted as a string in format mm-dd-yyyy hh:mi:ss:

to_char (to_date (the_string, 'yyyy-mm-dd hh:mi:ss'), 'mm-dd-yyyy hh:mi:ss')
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top