Returning a point just before a specific midnight with TRUNC : Date Functions « PL SQL Data Types « Oracle PL/SQL Tutorial






SQL>
SQL> create or replace function f_getMidnight_dt (i_date_dt DATE) return date is
  2  begin
  3      return trunc(i_date_dt)+1-1/(24*60*60);
  4  end;
  5  /

Function created.

SQL>
SQL> select f_getMidnight_dt(sysdate) from dual;

F_GETMIDN
---------
10-JUN-07








21.10.Date Functions
21.10.1.Working with dates and built-in functions EXTRACT
21.10.2.TRUNC and ROUND
21.10.3.ROUND
21.10.4.ADD_MONTHS
21.10.5.LAST_DAY
21.10.6.MONTHS_BETWEEN
21.10.7.Use TRUNC to get only the time
21.10.8.Returning a point just before a specific midnight with TRUNC
21.10.9.TO_DATE('29-DEC-1988','dd-mon-yyyy')