-
yesterday's time
Hello everyone,
I want to get the same time in yesterday, is there any bug in my below code?
My concern is code, _CurrentDate.Now.Day - 1, if current date is 1, 1 minus 1 is zero, not a valid date?
Code:
DateTime _CurrentDate = DateTime.Now;
DateTime _LastDate = new DateTime(_CurrentDate.Now.Year, _CurrentDate.Now.Month, _CurrentDate.Now.Day - 1, _CurrentDate.Now.Hour, _CurrentDate.Now.Second);
thanks in advance,
George
-
You want to subtract one day from your date ? Well, how about reading the help file, which will tell you how to do so one the very first page ? I will not be your copy&paste fool. Go read up on it for yourself.
-
And really you might consider stopping the cross posts...
Search for every thread you started here and you will find like 3 different places where you asked the question...
For this thread you can get answers at codeguru (www.codeguru.com/forum/showthread.php?threadid=454601) and at http://forums.devarticles.com/net-development-43/
If you really find it that hard to come up with solutions to problems like this then well i can only conclude you are not that good of a programmer... If you don't know search the help pages on msdn, if that still doesnt help you forward you can still think about things a bit and find out yourself...
Sorry if this sounds offending but thats just my opinion.
And oh yeah before i forget those are not the only places you cross post at: csharpfriends, boardreader.com, forums.msdn.microsoft.com and probably many more all seem favorite places for you to spam your questions around.