Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing Dates
Message
 
À
26/11/2002 09:34:45
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
00726955
Message ID:
00726990
Vues:
15
This message has been marked as the solution to the initial question of the thread.
>In C#, how do you compare 2 dates? I am not interested in the time, just the Dates.
>
>This example says that t3 is less than t4. How do I compare only the Date portion of t3 and t4? In this case, I want the Compare to say the two values are equal.
>
>DateTime t3 = DateTime.Today;
>DateTime t4 = DateTime.Now;
>int myint = DateTime.Compare(t3, t4);
>MessageBox.Show(myint.ToString());
>
>Thanks,
>
>Jerry

One way:
if (t3.Date == t4.Date)
{
   MessageBox.Show("Dates are equal");
}
Michael McLain
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform