Skip to Main Content

Japanese

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

date

2839801Nov 30 2015 — edited Dec 4 2015

what is trunc(date)?

This post has been answered by Papageno on Dec 4 2015
Jump to Answer

Comments

Jagadekara

Hi,

The following link may help you...

Oracle/PLSQL: TRUNC Function (with dates)

Papageno
Answer

SQL> ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY/MM/DD HH24:MI:SS' ;

Session altered.

SQL> SELECT SYSDATE

  2       , TRUNC(SYSDATE, 'MI') AS TRUNC_MI

  3       , TRUNC(SYSDATE, 'HH') AS TRUNC_HH

  4       , TRUNC(SYSDATE)       AS TRUNCED

  5       , TRUNC(SYSDATE, 'MM') AS TRUNC_MM

  6       , TRUNC(SYSDATE, 'YY') AS TRUNC_YY

  7  FROM DUAL ;

SYSDATE             TRUNC_MI            TRUNC_HH            TRUNCED             TRUNC_MM            TRUNC_YY

------------------- ------------------- ------------------- ------------------- ------------------- -------------------

2015/12/05 09:12:45 2015/12/05 09:12:00 2015/12/05 09:00:00 2015/12/05 00:00:00 2015/12/01 00:00:00 2015/01/01 00:00:00

Marked as Answer by 2839801 · Sep 27 2020
1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 1 2016
Added on Nov 30 2015
2 comments
1,188 views