TRUNC() parameter list : TRUNC « Date Timestamp Functions « Oracle PL/SQL Tutorial

Oracle PL/SQL Tutorial
1. Introduction
2. Query Select
3. Set
4. Insert Update Delete
5. Sequences
6. Table
7. Table Joins
8. View
9. Index
10. SQL Data Types
11. Character String Functions
12. Aggregate Functions
13. Date Timestamp Functions
14. Numerical Math Functions
15. Conversion Functions
16. Analytical Functions
17. Miscellaneous Functions
18. Regular Expressions Functions
19. Statistical Functions
20. Linear Regression Functions
21. PL SQL Data Types
22. PL SQL Statements
23. PL SQL Operators
24. PL SQL Programming
25. Cursor
26. Collections
27. Function Procedure Packages
28. Trigger
29. SQL PLUS Session Environment
30. System Tables Data Dictionary
31. System Packages
32. Object Oriented
33. XML
34. Large Objects
35. Transaction
36. User Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL/SQL Tutorial » Date Timestamp Functions » TRUNC 
13. 24. 1. TRUNC() parameter list
AspectParameter DescriptionExample
CenturyCCTwo-digit century.
21CenturySCC
Two-digit century with a negative sign (C) for B.C.-10Quarter
QOne-digit quarter of the year.1
YearYYYYAll four digits of the year.
2006YearIYYY
All four digits of the ISO year.2006Year
RRRRAll four digits of the rounded year, which depends on the current year.2006
YearSYYYYAll four digits of the year with a negative sign (C) for B.C.
C1001YearY,YYY
All four digits of the year with a comma.2,006Year
YYYLast three digits of the year.006
YearIYYLast three digits of the ISO year.
006YearYY
Last two digits of the year.06Year
IYLast two digits of the ISO year. 06Year
RRLast two digits of the rounded year, which depends on the current year.06
YearYLast digit of the year.
6YearI
Last digit of the ISO year.6Year
YEARName of the year in uppercase.TWO THOUSAND-SIX
YearYearName of the year with the first letter in uppercase.
Two Thousand-SixMonthMM
Two-digit month of the year.01Month
MONTHFull name of the month in uppercase, right-padded with spaces to a total length of nine characters.JANUARY
MonthMonthFull name of the month with first letter in uppercase, right-padded with spaces to a total length of nine characters.
JanuaryMonthMON
First three letters of the name of the month in uppercase.JANMonth
MonFirst three letters of the name of the month with the first letter in uppercase.Jan
MonthRMRoman numeral month.
The Roman numeral month for the fourth month (April) is IV.WeekWW
Two-digit week of the year.02Week
IWTwo-digit ISO week of the year.02
WeekWOne-digit week of the month.
2DayDDD
Three-digit day of the year.103Day
DDTwo-digit day of the month.31
DayDOne-digit day of the week.
5DayDAY
Full name of the day in uppercase.SATURDAYDay
DayFull name of the day with the first letter in uppercase.Saturday
DayDYFirst three letters of the name of the day in uppercase.
SATDayDy
First three letters of the name of the day with the first letter in uppercase.SatDay
JJulian day-the number of days that have passed since January 1, 4713 B.C.2439892
HourHH24Two-digit hour in 24-hour format.
23HourHH
Two-digit hour in 12-hour format.11Minute
MITwo-digit minute.57
SecondSSTwo-digit second.
45SecondFF[1..9]
Fractional seconds with an optional number of digits to the right of the decimal point. Only applies timestamps,When dealing with 0.123456789 seconds, FF3 would round to 0.123.SecondSSSSS
Number of seconds past 12 a.m.46748Second
MSMillisecond (millionths of a second).100
SecondCSCentisecond (hundredths of a second).
10Separators-/,.;: "text"
Characters that allow you to separate the aspects of a date and time. You can supply freeform text in quotes as a separator.When dealing with the date December 13, 1969, DD-MM-YYYY would produce 12-13-1969 and DD/MM/YYYY would produce 12/13/1969Suffixes
AM or PMAM or PM as appropriate.AM
SuffixesA.M. or P.M.A.M. or P.M. as appropriate.
P.M.SuffixesAD or BC
AD or BC as appropriate.ADSuffixes
A.D. or B.C.A.D. or B.C. as appropriate.B.C.
SuffixesTHSuffix to a number. You can make the suffix uppercase by specifying the numeric format in uppercase and vice versa for lowercase.When dealing with a day number of 28, ddTH would produce 28th and DDTH would produce 28TH
SuffixesSPNumber is spelled out.When dealing with a day number of 28, DDSP would produce TWENTY-EIGHT and ddSP would produce twenty-eight
SuffixesSPTHCombination of TH and SP.When dealing with a day number of 28, DDSPTH would produce TWENTY-EIGHTH and ddSPTH would produce twenty-eighth
EraEEFull era name for Japanese Imperial, ROC Official, and Thai Buddha calendars.
No exampleEraE
Abbreviated era name.No exampleTime zones
TZHTime zone hour.12
Time zonesTZMTime zone minute.
30Time zonesTZR
Time zone region.PSTTime zones
TZDTime zone with daylight savings information.No example


Quote from:

Oracle Database 10g SQL (Osborne ORACLE Press Series) (Paperback)

# Paperback: 608 pages

# Publisher: McGraw-Hill Osborne Media; 1st edition (February 20, 2004)

# Language: English

# ISBN-10: 0072229810

# ISBN-13: 978-0072229813

SQL>
SQL> select sysdate
  2  ,      trunc(sysdate,'CC')     as trunc_cc
  3  from   dual;

SYSDATE   TRUNC_CC
--------- ---------
24-JUL-08 01-JAN-01

SQL>
SQL>
13. 24. TRUNC
13. 24. 1. TRUNC() parameter list
13. 24. 2. TRUNC(x[, unit]) truncates x.
13. 24. 3. How Oracle Interprets Two-Digit Years
13. 24. 4. Truncates May 25, 2005, to the first day in the month
13. 24. 5. Truncates 7:45:26 P.M. on May 25, 2005 to the hour
13. 24. 6. Examples of the TRUNC function being applied to datetime values
13. 24. 7. TRUNC(date_in,'YYYY')
13. 24. 8. TRUNC(date_in,'MM')
13. 24. 9. TRUNC(): truncate May 25, 2005, to the first day in the year
13. 24. 10. Use TRUNC(date_variable) when you want to extract a date from a timestamp
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.