SELECT CONVERT(VARCHAR, GETDATE(), 100)
SELECT CONVERT(VARCHAR, GETDATE(), 101)
SELECT CONVERT(VARCHAR, GETDATE(), 102)
SELECT CONVERT(VARCHAR, GETDATE(), 103)
SELECT CONVERT(VARCHAR, GETDATE(), 104)
SELECT CONVERT(VARCHAR, GETDATE(), 105)
SELECT CONVERT(VARCHAR, GETDATE(), 106)
SELECT CONVERT(VARCHAR, GETDATE(), 107)
SELECT CONVERT(VARCHAR, GETDATE(), 108)
SELECT CONVERT(VARCHAR, GETDATE(), 109)
SELECT CONVERT(VARCHAR, GETDATE(), 110)
SELECT CONVERT(VARCHAR, GETDATE(), 111)
SELECT CONVERT(VARCHAR, GETDATE(), 112)
SELECT CONVERT(VARCHAR, GETDATE(), 113)
SELECT CONVERT(VARCHAR, GETDATE(), 114)
SELECT CONVERT(VARCHAR, GETDATE(), 120)
SELECT CONVERT(VARCHAR, GETDATE(), 121)
SELECT CONVERT(VARCHAR, GETDATE(), 126)
For Example.
SELECT COUNT(*) AS CUST, SUBSTRING(CONVERT(VARCHAR(10), CREATEDDATE, 106), 0,7) AS DATE FROM
COMPANY
WHERE CONVERT(DATE,CREATEDDATE) >= CONVERT(DATE,DATEADD(DAY, -30, GETDATE()))