My requirement is to get the 1st date of the year. I'm using below command line to fulfill this task.
SELECT CONVERT(VARCHAR,YEAR(GETDATE())-1)+'/01/01'
When it become the last day of the year, I can change the query like this.
SELECT CONVERT(VARCHAR,YEAR(GETDATE())-1)+'/12/01'
Then I want the 1st February in this year. It can be taken by using
SELECT CONVERT(VARCHAR,YEAR(GETDATE())-1)+'/02/01'
I believe this command will help you to cater your various requirements.
No comments:
Post a Comment