|
|
Re: How To display last day of a century [message #670170 is a reply to message #670164] |
Wed, 13 June 2018 10:10 |
Solomon Yakobson
Messages: 3285 Registered: January 2010 Location: Connecticut, USA
|
Senior Member |
|
|
Michel Cadot wrote on Wed, 13 June 2018 01:42
Note that the last day of the 21th century is 31-DEC-2100, NOT 2099.
That is Gregorian calendar definition: 100 * n + 1 through 100 * (n + 1) when n=0,1,2,... "Common life" usage is 100 * n through 100 * n + 99. Oracle follows Gregorian calendar definition. Implementing "common life" definition:
SQL> select add_months(trunc(sysdate,'cc'),12 * 99) - 1
2 from dual
3 /
ADD_MONTHS(
-----------
31-dec-2099
SQL> select to_date(to_char(sysdate,'cc') || '000101','yyyymmdd') - 1
2 from dual
3 /
TO_DATE(TO_
-----------
31-dec-2099
SQL>
SY.
|
|
|
|