C# Programming
09-27-2009, 05:52 AM
Hi.
I'm gonna take the DateTime of 24 hours former with C# , I've written below code :
DateTime _24HoursFormer
{
get { return new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day - 1, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); }
}
But whenever DateTime.Now.Day equals 1, it throws an Exception !!
Could you guide me ?
Thanks.
I'm gonna take the DateTime of 24 hours former with C# , I've written below code :
DateTime _24HoursFormer
{
get { return new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day - 1, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); }
}
But whenever DateTime.Now.Day equals 1, it throws an Exception !!
Could you guide me ?
Thanks.