I am trying to get current date – 6 days. That is easy.
Now I am trying to get current date – 6 days + 12:01 AM.
So if today is 3-2-2012 11:14 AM.
I want to get 2-25-2012 12:01 AM
These 2 selects will give me current date – 6, but will not reset the time to 12:01 AM
- select getdate()-6
- SELECT DATEADD(day, -6, CURRENT_TIMESTAMP);
Using the following will give you the result in a
datetimeformat:Result:
2012-02-25 00:01:00.000Once you have the datetime that you want, you can convert it to many different formats.
Or you can do the following which is in a
varcharformat:which results in
02-25-2012 12:01 AM