Oracle: how to add minutes to a timestamp?

前端 未结 13 1294
盖世英雄少女心
盖世英雄少女心 2020-11-30 02:37

I need to add 30 minutes to values in a Oracle date column. I do this in my SELECT statement by specifying

to_char(date_and_time + (.000694 * 31)

13条回答
  •  情书的邮戳
    2020-11-30 03:01

    If the data type of the field is date or timestamp, Oracle should always give the correct result if you add the correct number given in number of days (or a the correct fraction of a day in your case). So if you are trying to bump the value in 30 minutes, you should use :

    select field + 0.5/24 from table;
    

    Based on the information you provided, I believe this is what you tried to do and I am quite sure it works.

提交回复
热议问题