Date and Time in SQL Server
I am going
to share my experience with you all dear!
To get
difference between two ranges to date and time i have done using DATEDIFF funtion
My Example
is:
I have
From Date and To Date to get "Year” difference between these two
dates
SELECT
DATEDIFF(YEAR, @Frmdt, @Todt )
as Duration
Here i the
most useful list of DateTime function
GETDATE()
DATEADD()
DATENAME()
DAY()
MONTH()
YEAR()
DATEDIFF()
CONVERT()
DATEPART()
SYSDATETIME()
SYSDATETIME()
SWITCHOFFSET()
TODATETIMEOFFSET()
ISDATE()
SYSUTCDATETIME()
GETUTCDATE()
CURRENT_TIMESTAMP()
DATEFROMPARTS()
DATETIME2FROMPARTS()
DATETIMEFROMPARTS()
DATETIMEOFFSETFROMPARTS()
SMALLDATETIMEFROMPARTS()
TIMEFROMPARTS()
EOMONTH()