oracle month calculated the time difference between the two, a difference of a few weeks, a difference of how many days

Number of days difference:
   SYSDATE-TO_DATE ( '1991-01-01', 'YYYY-the MM-DD')) <. 7 and (SYSDATE-TO_DATE ( '01 = 1991 = 01', 'the MM-DD-YYYY')) > 0 
   

differ by a few weeks
  to obtain a to_char (sysdate, 'ww') for the year the first time how many weeks, the same way you can get the difference subtraction
  

month difference between the two time
 select substr (to_char (sysdate, ' YYYY-MM-DD '), 1, 4) -substr (' 1999-01-01 ', 1, 4))) * 12 -to_number ((substr (to_char (sysdate,' YYYY-MM-DD '), 6, 2) -substr ( '1999-01-01 ', 6, 2)))
In general, the difference is multiplied by 12 with the year, month plus the difference

Reproduced in: https: //www.cnblogs.com/pretty-guy/p/3285517.html

Guess you like

Origin blog.csdn.net/weixin_34005042/article/details/93438702