0

I have one table with below data. Data type of START_TIME is timestamp(0) & AVG_RUN_TIME_MINS is Integer. I want to print EXPECTED_COMPLETION_TIME which is equal to - (START_TIME + AVG_RUN_TIME_MINS) and output will be in format like - '10:00 AM' or '08:00 PM'.

How to achieve this scenario?

START_TIME             AVG_RUN_TIME_MINS
----------------------------------------
8/27/2020 06:14:49             120
8/27/2020 16:10:28             3
8/27/2020 06:01:05             60
8/27/2020 05:50:30             85

1 Answers1

1

Add the minutes to the start time and use TO_CHAR to disply it as a string:

to_char(START_TIME + cast(AVG_RUN_TIME_MINS as interval minute(4)), 'hh:mi AM')
dnoeth
  • 59,503
  • 4
  • 39
  • 56