please tell me how two dates can be subtracted in asp.net

please tell me how two dates can be subtracted in asp.net

DateTime.Subtract(DateTime) will give you a TimeSpan object, from which you can extract the difference in days, hours, minutes, etc.

DateTime.Subtract(TimeSpan) will give you another DateTime that will be the old date minus whatever time you indicated.

And, of course, there are various .Add functions, such as AddDays(int), AddHours(int), etc. You can use positive or negative values, so a with DateTime holding #2/1/2010 12:00:00 AM#, you can use .AddSeconds(-1) to get #1/31/2010 11:59:59 PM#.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.