MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

DATABASE & SQL/PLSQL

Date Functions in SQL
Previous Home Next

Features of date functions area

  1. Used to manipulate date time values
  2. Perform arithmetic operations
  3. Perform date parsing
  4. Add two date or subtract one date from another

SELECT date_function (parameters)

date_function is the name of date function

parameters are the required parameters of the date function

 

Eunction NameParameterDescription
DATEADD (datepart,number,date) Adds the number of dateparts to the date
DATEDIFF (datepart,date1,date2)<\i> Calculates the number of dateparts between two dates
DATENAME (datepart,date)<\i> Return datepart from the listed date, as character value (for example: March)
DATEPART (datepart,date)<\i> Returns datepart from the listed date as an integer
GETDATE ()<\i> Returns current date and time

Example

SELECT getdate()

The above statement display the current system date by using getdate() function.

SELECT  'getdate'= DATEADD(yy,2,pubdate)
FROM titles

output

Return the all pubdate from titles table with increment of 2 in each year of the table.

SELECT datepart (yy,pubdate)
FROM titles

Return all Date from pubdate of titles table.

Previous Home Next