SlideShare a Scribd company logo
1 of 12
e-Infochips Institute of Training Research and Academics Limited
Date and Time Functions
Prepared by : Pranali Patel
Akshit Patel
Date and Time Functions
• The DATE data type is used to store date and time
information. The DATE data type has special
properties associated with it.
• It stores information about century, year, month,
day, hour, minute and second for each date value.
• The default format of Date data type is ‘DD-MM-
YY HH:MM:SS’.
• We can also change the date format using function.
Examples
• CURRENT_DATE:
It returns the current system date.
e.g.,
select current_date from dual;
11-APR-17
• CURRENT_TIMESTAMP:
It returns the current system date, time.
It is same as now() function.
e.g.,
select current_timestamp from dual;
11-APR-17 03.36.54.1000 PM
• ADD_MONTHS(d,n):
It returns the date adding number of month specified in the
function.
e.g.,
select add_months(sysdate, 3) from dual;
11-JULY-17
• LAST_DAY(d):
It returns the last date of the month specified with the
function.
e.g.,
select last_day(sysdate) from dual;
30-APR-17
Date conversion
• TO_CHAR:
It converts a value of DATE datatype to CHAR value.
e.g.,
select to_char ( sysdate, ‘month dd, yyyy’) from dual;
APRIL 11, 2017
• TO_DATE:
It converts characters field to date field.
e.g.,
select to_date (’11 april,2017’, ‘dd-mm-yyyy’) from dual;
11-APR-17
• NEXT_DAY(d,c):
It returns the date of the first week day named by c, that is
after the date named by d.
e.g.,
select next_day ( sysdate, ‘Monday’) from dual;
17-APR-2017
• MONTHS_BETWEEN(d1,d2):
It returns the number of months between d1 and d2.
e.g.,
select months_between( ‘11-july-17’, sysdate) from dual;
3
• ROUND:
It returns a date rounded to specific unit of measure.
e.g.,
select round(sysdate, ’yyyy’) from dual;
1-JAN-2017
• DATEDIFF(d1,d2):
It returns the difference between two dates.
e.g.,
SELECT datediff('2017-04-15',CURRENT_DATE)
from DUAL;
4
• DAYOFMONTH(d):
It returns a date of month.
e.g.,
SELECT dayofmonth(sysdate);
11
• DAYOFYEAR(d):
It returns a day of the year (in range 1 to 366).
e.g.,
SELECT dayofyear(sysdate);
101
• DAYOFWEEK(d):
It returns a weekday index for specified date.
e.g.,
SELECT dayofweek(sysdate);
3
• FROM_DAYS(n):
It returns the date value according to given number.
e.g.,
SELECT from_days(366) from dual;
0001-01-01
• MAKEDATE(y,n):
It returns a date according to given year and day of year
value.
e.g.,
select makedate (2017, 101) from dual;
2017-04-11
• QUARTER(d):
e.g.,
SELECT quarter(now()) from dual;
2
• SEC_TO_TIME(n):
e.g.,
SELECT sec_to_time(1234) from dual;
00:20:34
• Time(t):
e.g.,
SELECT time(now());
17:02:38
• TIME_TO_SEC(t):
e.g.,
SELECT time_to_sec(now()) from dual;
61541
• HOUR(t):
e.g.,
SELECT hour(now()) from dual;
17
• MINUTE(t):
e.g.,
SELECT minute(now()) from dual;
15
Thank you

More Related Content

Similar to datetimefuction-170413055211.pptx

UNIT 3_Part I_GUIDELINES FOR CLASS DESIGN.pdf
UNIT 3_Part I_GUIDELINES FOR CLASS DESIGN.pdfUNIT 3_Part I_GUIDELINES FOR CLASS DESIGN.pdf
UNIT 3_Part I_GUIDELINES FOR CLASS DESIGN.pdfGauravDwivedi695361
 
Tactical data engineering
Tactical data engineeringTactical data engineering
Tactical data engineeringJulian Hyde
 
Synapse india dotnet development overloading operater part 4
Synapse india dotnet development overloading operater part 4Synapse india dotnet development overloading operater part 4
Synapse india dotnet development overloading operater part 4Synapseindiappsdevelopment
 
Date data type and Globalization in Oracle
Date data type and Globalization in OracleDate data type and Globalization in Oracle
Date data type and Globalization in OracleMasoud Haji Hassan Pour
 
Manipulating data with dates
Manipulating data with datesManipulating data with dates
Manipulating data with datesRupak Roy
 
COM1407: Structures, Unions & Dynamic Memory Allocation
COM1407: Structures, Unions & Dynamic Memory Allocation COM1407: Structures, Unions & Dynamic Memory Allocation
COM1407: Structures, Unions & Dynamic Memory Allocation Hemantha Kulathilake
 
Please I am posting the fifth time and hoping to get this r.pdf
Please I am posting the fifth time and hoping to get this r.pdfPlease I am posting the fifth time and hoping to get this r.pdf
Please I am posting the fifth time and hoping to get this r.pdfankit11134
 
13 -times_and_dates
13  -times_and_dates13  -times_and_dates
13 -times_and_datesHector Garzo
 
C++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdfC++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdfjaipur2
 
Excel DATEDIFF Function
Excel DATEDIFF FunctionExcel DATEDIFF Function
Excel DATEDIFF FunctionExcel
 
How to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
How to write SQL queries | pgDay Paris 2019 | Dimitri FontaineHow to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
How to write SQL queries | pgDay Paris 2019 | Dimitri FontaineCitus Data
 
Data Wrangling: Working with Date / Time Data and Visualizing It
Data Wrangling: Working with Date / Time Data and Visualizing ItData Wrangling: Working with Date / Time Data and Visualizing It
Data Wrangling: Working with Date / Time Data and Visualizing Itkanaugust
 
SessionSeven_WorkingWithDatesandTime
SessionSeven_WorkingWithDatesandTimeSessionSeven_WorkingWithDatesandTime
SessionSeven_WorkingWithDatesandTimeHellen Gakuruh
 
14. Alex Lightstone & Bill Prescot - Exploiting PeopleSoft Query & Pivot Grids
14. Alex Lightstone & Bill Prescot - Exploiting PeopleSoft Query & Pivot Grids14. Alex Lightstone & Bill Prescot - Exploiting PeopleSoft Query & Pivot Grids
14. Alex Lightstone & Bill Prescot - Exploiting PeopleSoft Query & Pivot GridsCedar Consulting
 
Data Exploration with Apache Drill: Day 2
Data Exploration with Apache Drill: Day 2Data Exploration with Apache Drill: Day 2
Data Exploration with Apache Drill: Day 2Charles Givre
 
Date class that represents a date consisting of a year, month, and a.pdf
Date class that represents a date consisting of a year, month, and a.pdfDate class that represents a date consisting of a year, month, and a.pdf
Date class that represents a date consisting of a year, month, and a.pdfanilgoelslg
 
Python and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri Fontaine
Python and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri FontainePython and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri Fontaine
Python and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri FontaineCitus Data
 
Useful date number and string sql queries
Useful date number and string sql queriesUseful date number and string sql queries
Useful date number and string sql queriesFeras Ahmad
 
Sofware engineering
Sofware engineeringSofware engineering
Sofware engineeringKavi Kumar
 

Similar to datetimefuction-170413055211.pptx (20)

UNIT 3_Part I_GUIDELINES FOR CLASS DESIGN.pdf
UNIT 3_Part I_GUIDELINES FOR CLASS DESIGN.pdfUNIT 3_Part I_GUIDELINES FOR CLASS DESIGN.pdf
UNIT 3_Part I_GUIDELINES FOR CLASS DESIGN.pdf
 
Tactical data engineering
Tactical data engineeringTactical data engineering
Tactical data engineering
 
Synapse india dotnet development overloading operater part 4
Synapse india dotnet development overloading operater part 4Synapse india dotnet development overloading operater part 4
Synapse india dotnet development overloading operater part 4
 
Date data type and Globalization in Oracle
Date data type and Globalization in OracleDate data type and Globalization in Oracle
Date data type and Globalization in Oracle
 
Manipulating data with dates
Manipulating data with datesManipulating data with dates
Manipulating data with dates
 
COM1407: Structures, Unions & Dynamic Memory Allocation
COM1407: Structures, Unions & Dynamic Memory Allocation COM1407: Structures, Unions & Dynamic Memory Allocation
COM1407: Structures, Unions & Dynamic Memory Allocation
 
Please I am posting the fifth time and hoping to get this r.pdf
Please I am posting the fifth time and hoping to get this r.pdfPlease I am posting the fifth time and hoping to get this r.pdf
Please I am posting the fifth time and hoping to get this r.pdf
 
13 -times_and_dates
13  -times_and_dates13  -times_and_dates
13 -times_and_dates
 
C++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdfC++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdf
 
Excel DATEDIFF Function
Excel DATEDIFF FunctionExcel DATEDIFF Function
Excel DATEDIFF Function
 
MySQL Functions
MySQL FunctionsMySQL Functions
MySQL Functions
 
How to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
How to write SQL queries | pgDay Paris 2019 | Dimitri FontaineHow to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
How to write SQL queries | pgDay Paris 2019 | Dimitri Fontaine
 
Data Wrangling: Working with Date / Time Data and Visualizing It
Data Wrangling: Working with Date / Time Data and Visualizing ItData Wrangling: Working with Date / Time Data and Visualizing It
Data Wrangling: Working with Date / Time Data and Visualizing It
 
SessionSeven_WorkingWithDatesandTime
SessionSeven_WorkingWithDatesandTimeSessionSeven_WorkingWithDatesandTime
SessionSeven_WorkingWithDatesandTime
 
14. Alex Lightstone & Bill Prescot - Exploiting PeopleSoft Query & Pivot Grids
14. Alex Lightstone & Bill Prescot - Exploiting PeopleSoft Query & Pivot Grids14. Alex Lightstone & Bill Prescot - Exploiting PeopleSoft Query & Pivot Grids
14. Alex Lightstone & Bill Prescot - Exploiting PeopleSoft Query & Pivot Grids
 
Data Exploration with Apache Drill: Day 2
Data Exploration with Apache Drill: Day 2Data Exploration with Apache Drill: Day 2
Data Exploration with Apache Drill: Day 2
 
Date class that represents a date consisting of a year, month, and a.pdf
Date class that represents a date consisting of a year, month, and a.pdfDate class that represents a date consisting of a year, month, and a.pdf
Date class that represents a date consisting of a year, month, and a.pdf
 
Python and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri Fontaine
Python and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri FontainePython and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri Fontaine
Python and PostgreSQL: Let's Work Together! | PyConFr 2018 | Dimitri Fontaine
 
Useful date number and string sql queries
Useful date number and string sql queriesUseful date number and string sql queries
Useful date number and string sql queries
 
Sofware engineering
Sofware engineeringSofware engineering
Sofware engineering
 

More from YashaswiniSrinivasan1 (9)

1-161103092724.pptx
1-161103092724.pptx1-161103092724.pptx
1-161103092724.pptx
 
introductionofssis-130418034853-phpapp01.pptx
introductionofssis-130418034853-phpapp01.pptxintroductionofssis-130418034853-phpapp01.pptx
introductionofssis-130418034853-phpapp01.pptx
 
thegrowingimportanceofdatacleaning-211202141902.pptx
thegrowingimportanceofdatacleaning-211202141902.pptxthegrowingimportanceofdatacleaning-211202141902.pptx
thegrowingimportanceofdatacleaning-211202141902.pptx
 
stored.ppt
stored.pptstored.ppt
stored.ppt
 
Chapter5.ppt
Chapter5.pptChapter5.ppt
Chapter5.ppt
 
database.ppt
database.pptdatabase.ppt
database.ppt
 
ms-sql-server-150223140402-conversion-gate02.pptx
ms-sql-server-150223140402-conversion-gate02.pptxms-sql-server-150223140402-conversion-gate02.pptx
ms-sql-server-150223140402-conversion-gate02.pptx
 
lecture-sql.ppt
lecture-sql.pptlecture-sql.ppt
lecture-sql.ppt
 
ch1.ppt
ch1.pptch1.ppt
ch1.ppt
 

Recently uploaded

APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Recently uploaded (20)

APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

datetimefuction-170413055211.pptx

  • 1. e-Infochips Institute of Training Research and Academics Limited Date and Time Functions Prepared by : Pranali Patel Akshit Patel
  • 2. Date and Time Functions • The DATE data type is used to store date and time information. The DATE data type has special properties associated with it. • It stores information about century, year, month, day, hour, minute and second for each date value. • The default format of Date data type is ‘DD-MM- YY HH:MM:SS’. • We can also change the date format using function.
  • 3. Examples • CURRENT_DATE: It returns the current system date. e.g., select current_date from dual; 11-APR-17 • CURRENT_TIMESTAMP: It returns the current system date, time. It is same as now() function. e.g., select current_timestamp from dual; 11-APR-17 03.36.54.1000 PM
  • 4. • ADD_MONTHS(d,n): It returns the date adding number of month specified in the function. e.g., select add_months(sysdate, 3) from dual; 11-JULY-17 • LAST_DAY(d): It returns the last date of the month specified with the function. e.g., select last_day(sysdate) from dual; 30-APR-17
  • 5. Date conversion • TO_CHAR: It converts a value of DATE datatype to CHAR value. e.g., select to_char ( sysdate, ‘month dd, yyyy’) from dual; APRIL 11, 2017 • TO_DATE: It converts characters field to date field. e.g., select to_date (’11 april,2017’, ‘dd-mm-yyyy’) from dual; 11-APR-17
  • 6. • NEXT_DAY(d,c): It returns the date of the first week day named by c, that is after the date named by d. e.g., select next_day ( sysdate, ‘Monday’) from dual; 17-APR-2017 • MONTHS_BETWEEN(d1,d2): It returns the number of months between d1 and d2. e.g., select months_between( ‘11-july-17’, sysdate) from dual; 3
  • 7. • ROUND: It returns a date rounded to specific unit of measure. e.g., select round(sysdate, ’yyyy’) from dual; 1-JAN-2017 • DATEDIFF(d1,d2): It returns the difference between two dates. e.g., SELECT datediff('2017-04-15',CURRENT_DATE) from DUAL; 4
  • 8. • DAYOFMONTH(d): It returns a date of month. e.g., SELECT dayofmonth(sysdate); 11 • DAYOFYEAR(d): It returns a day of the year (in range 1 to 366). e.g., SELECT dayofyear(sysdate); 101 • DAYOFWEEK(d): It returns a weekday index for specified date. e.g., SELECT dayofweek(sysdate); 3
  • 9. • FROM_DAYS(n): It returns the date value according to given number. e.g., SELECT from_days(366) from dual; 0001-01-01 • MAKEDATE(y,n): It returns a date according to given year and day of year value. e.g., select makedate (2017, 101) from dual; 2017-04-11
  • 10. • QUARTER(d): e.g., SELECT quarter(now()) from dual; 2 • SEC_TO_TIME(n): e.g., SELECT sec_to_time(1234) from dual; 00:20:34 • Time(t): e.g., SELECT time(now()); 17:02:38
  • 11. • TIME_TO_SEC(t): e.g., SELECT time_to_sec(now()) from dual; 61541 • HOUR(t): e.g., SELECT hour(now()) from dual; 17 • MINUTE(t): e.g., SELECT minute(now()) from dual; 15