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

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


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

[Returns current date and time]


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

DATEDIFF ( DatePart, StartDate, EndDate);


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() is helpful for getting a single part of a date/time. The Syntax is:

DATEPART (DatePart, Date);