Date and Time Functions In SQL Server 2012
DATEFROMPARTS ( year, month, day)
DATETIME2FROMPARTS ( year, month, day, hour, minute, seconds, fractions, precision )
DATETIMEFROMPARTS ( year, month, day, hour, minute, seconds, milliseconds )
DATETIMEOFFSETFROMPARTS ( year, month, day, hour, minute, seconds, fractions, hour_offset, minute_offset, precision )
SMALLDATETIMEFROMPARTS ( year, month, day, hour, minute )
TIMEFROMPARTS ( hour, minute, seconds, fractions, precision )
EOMONTH () — TO SHOW CND DATE IN MONTH
set dateformat dmy
select DATEFROMPARTS (1985,10,01)
SELECT DATETIME2FROMPARTS (1985,10,1,11,31,00,0,0)
SELECT DATETIMEFROMPARTS (1985,10,1,11,31,00,100)
SELECT DATETIMEOFFSETFROMPARTS (1985,10,1,11,33,12,0,11,0,7)
SELECT SMALLDATETIMEFROMPARTS (2010,12,31,23,59)
SELECT TIMEFROMPARTS (23,59,59,0,0)
select EOMONTH (‘1985/10/1’)
DATEFROMPARTS ( year, month, day)
DATETIME2FROMPARTS ( year, month, day, hour, minute, seconds, fractions, precision )
DATETIMEFROMPARTS ( year, month, day, hour, minute, seconds, milliseconds )
DATETIMEOFFSETFROMPARTS ( year, month, day, hour, minute, seconds, fractions, hour_offset, minute_offset, precision )
SMALLDATETIMEFROMPARTS ( year, month, day, hour, minute )
TIMEFROMPARTS ( hour, minute, seconds, fractions, precision )
EOMONTH () — TO SHOW CND DATE IN MONTH
set dateformat dmy
select DATEFROMPARTS (1985,10,01)
SELECT DATETIME2FROMPARTS (1985,10,1,11,31,00,0,0)
SELECT DATETIMEFROMPARTS (1985,10,1,11,31,00,100)
SELECT DATETIMEOFFSETFROMPARTS (1985,10,1,11,33,12,0,11,0,7)
SELECT SMALLDATETIMEFROMPARTS (2010,12,31,23,59)
SELECT TIMEFROMPARTS (23,59,59,0,0)
select EOMONTH (‘1985/10/1’)
No comments:
Post a Comment