Calculate, using C#, the number of days that are missing at a fixed date
This example allows you to calculate, using C#, the number of days that are missing at the end of the year.
Code:
using System;
namespace ConsoleApplications
{
class DaysCalculateDemo
{
static void Main(string[] args)
{
DateTime today = DateTime.Now;
DateTime expirationDate = new DateTime(2014, 12, 31);
TimeSpan ts = expirationDate - today;
int days = ts.Days;
System.Console.WriteLine("{0} days remaining at the end of the year!", days);
}
}
}