GetDate(), DateDiff(), DateAdd(), DatePart() commands in Oracle

Below is the one by one description of all the four date command with their syntax.

GETDATE():

GetDate() Command is used to get the current date and time of the system from standard. The syntax of GetDate() is:

SELECT GETDATE();
[Returns current date and time]

DATEDIFF():

DateDiff() Command is used to fetch the difference between the two different dates. Here is the syntax:

DATEDIFF ( DatePart, StartDate, EndDate);

DATEADD():

DateAdd() is used to add or delete the specified time interval you want to add. The abbreviations used for datepart are:

Year = yy, yyyy
Month = mm
Day = dd, d
Week = wk,ww
Hour = hh
Minute = min
Second = ss, s
Milisecond = ms

DATEPART():

DatePart() is helpful for getting a single part of a date/time. The Syntax is:

DATEPART (DatePart, Date);


Ebook Download
View all
Learn
View all
F11Research & Development, LLC