tags:

views:

906

answers:

3

i want to get datetime for 2days before. i.e) how to subtract 2 days from datetime.now

+23  A: 

I think you are just looking for:

DateTime.Now.AddDays(-2);
DocMax
+8  A: 

or try:

DateTime.Now.Subtract(TimeSpan.FromDays(2));
Joachim Kerschbaumer
+1  A: 

Yet another solution:

DateTime twoDays = DateTime.Now.Subtract(new TimeSpan(2,0,0,0));
JTA