I am trying to add hours and minutes to a timestamp. Over the last week I have found many suggestions via the web but none that would work for this scenario. What I have is a timestamp and then a variable with hours and another variable with minutes I want to subtract from the timestamp.
Things I have tried:
_add_days([call_stop_ts], [hours_minus]/24)
The above does not work due to the second argument requires an integer value it appears.
So for example:
[hours_minus] = 4
_add_days([call_stop_ts], 4/24)
evaluates to:
_add_days([call_stop_ts], 0.167)
Then when the second parameter has to be an integer you get:
_add_days([call_stop_ts], 0)
So nothing is changed.
I have also tried:
[call_stop_ts] - [hours_minus] hour
This does not work as it does not allow the value before hour to be a variable.
This works : [call_stop_ts] - 3 hour but I need the 3 value to be variable.
Have you figured out a solution to this issue? I am having the same problem myself. I need today's date but make it 7AM.
Thanks,
~Mark
Maybe go after it from a different angle. Instead of trying to add or subtract time, just build a string that has what you want and then cast the whole mess into a timestamp.
If all you need is the current date at 7:00 am this works:
cast ( cast( current_date, VARCHAR(15) ) || ' 07:00:00' , TIMESTAMP )
Thanks for your response.
This is what I did for my solution. Using Oracle DB.
TRUNC({SYSDATE}) + 7/24
Hope this helps.