Witam. Jak porównać dwie daty?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace Data
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hi");
DateTime dT = new DateTime();
string data = "2011 - 08 - 23";
DateTime.TryParse(data, out dT);
if (dT.Date < DateTime.Now)
Console.WriteLine("Ten dzień już był.");
else
{
Console.WriteLine("Ten dzień będzie albo trwa");
}
Console.ReadLine();
}
}
}
Program wyświetla, że ten dzień już był. Czy jest jakiś gotowy sposób na porównanie dwóch dat? Czy mam najpierw sprawdzać rok, miesiąc, a potem dzień po kolei?