Consider the following -
You want the user to enter a date into a text field. When the page intially loads you want the field to default to yesterday. Simple yes? Well getting the page to display it is, yes. But what about the code behind it?
Well in C# you can use the DateTime class to handle this kind of thing, so we’ll do that.
System.DateTime.Today;
Thats fine if you want your DateTime object to be today. But what if you want it to be yesterday? An interesting question.
Ill give you a hint - this doesn’t work
System.DateTime.Yesterday;
Well, after some searching through the api’s I could see no simple way of doing it. There is no .RemoveDay method. You could play around with ticks and all sorts of other fancy things but there is this very simple way of doing it.
System.DateTime.Today.AddDays(-1);
Simple huh?
Initially I was thinking its kind of counter intuitive but now that I’ve been using it for while it makes sense.
Just another thing to put down to experience.

