+ 3
Wow, sounds like an interview question ;-)
These functions are useful if you have a column n a table with the timestamp format.
Use TO_DATE to convert a string into a date, e.g. when inserting a new timestamp value into a table:
INSERT INTO table (timestamp_column, column2...) VALUES (TO_DATE('07/09/2016', 'DD/MM/YYYY')...)
Here, you can specify the date format your date string has and the TO_DATE function converts into the timestamp.
Use TO_CHAR when selecting values from a timestamp column and to display in your desired format, e.g.:
SELECT TO_CHAR(timestamp_column, 'MM/DD/YYYY')... FROM table;
This way you see the date in a format you want, rather than the raw timestamp value.



