라이프로그


날짜 구하기 DB창고

--지난달의마지막날구하기

selectdateadd(ms,-3,DATEADD(mm,DATEDIFF(mm,0,getdate()),0))

 

--지난해의마지막날구하기

selectdateadd(ms,-3,DATEADD(yy,DATEDIFF(yy,0,getdate()),0))

 

--현재달의첫째날구하기

selectDATEADD(mm,DATEDIFF(mm,0,getdate()),0)

 

--현재달의마지막날구하기

selectdateadd(ms,-3,DATEADD(mm,DATEDIFF(m,0,getdate())+1,0))

 

--현재해의마지막날구하기

selectdateadd(ms,-3,DATEADD(yy,DATEDIFF(yy,0,getdate())+1,0))

 

--현재달의첫째주월요일구하기

selectDATEADD(wk,DATEDIFF(wk,0,dateadd(dd,6-datepart(day,getdate()),getdate())),0)

 

--현재주의월요일구하기

selectDATEADD(wk,DATEDIFF(wk,0,getdate()),0)

 

--현재해의첫째날구하기

selectDATEADD(yy,DATEDIFF(yy,0,getdate()),0)

 

--현재분기의첫째날구하기

selectDATEADD(qq,DATEDIFF(qq,0,getdate()),0)

 

--현재날의자정구하기

selectDATEADD(dd,DATEDIFF(dd,0,getdate()),0)

 


덧글

댓글 입력 영역