Skip to content
Advertisement

How I can convert date to char and then ti number?

Please help to sole this task. I need convert date to char and then to number, so that i can perform arithmetic operation and divide the date by 2.

select (sysdate+30+30+89)/2 from dual;

This query doesn’t work and i have no idea how i can convert date to number.

Advertisement

Answer

Based on the understanding of the question I think you need the current day of the year to perform arithmetic operation

  SELECT (to_number(to_char(sysdate,'DDD'))+30+30+89)/2 from dual;
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement