David
David

Reputation: 31

Text to Date & time

I have two field, Date and Time. Both are Text formated. I need to bring them togeather as a date/time format so we can caluate time used. We are using current date/time - the text date/time. What is the best way to change the format of the date time text fields into one field that has a date/time format. Thank you

Upvotes: 0

Views: 314

Answers (1)

Tony Andrews
Tony Andrews

Reputation: 132580

select to_date (date_field || time_field, 'xxx') from ...

Change 'xxx' to the format that matches the concatenated value. For example, if date_field is like '01-JAN-2010' and time_field is like '23:49:12' then:

select to_date (date_field || time_field, 'DD-MON-YYYYHH24:MI:SS') from ...

Upvotes: 4

Related Questions