>This is not a good way, but can you explain again what you were trying to achieve and what is the table structure, some input data and desired output?
Those who built the database decided to store the date in a Date field (just the date portion) and the time into a Char(8) field. So, this is the problem I had to deal with.