TO_DATE fuction returns timestamp value, apart from it's name.
If some date elements were not included in source string, values of CURRENT DATE would be substituted.
TIME function can be used to extract time value from the result of TO_DATE.
TIME( TO_DATE(source_string , 'hh24miss') ) would be a simlest way, now in DB2 SQL.
I tried various ways/expressions to convert from string to time/date/timestamp or reverse.
It was fun for me.
Though (I think) we should use DB2 function(s) to convert from string to time/date/timestamp(TO_DATE) and vice versa(TO_CHAR),
except some specific format which were not supported by those DB2 functions, or for which other simple functions/expression could be applied.
Last edited by tonkuma; 05-26-12 at 12:36.
Reason: Revise English.