Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing Dates in C#
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01524808
Message ID:
01524936
Vues:
53
>What is the equivalent of the ^ symbol in C#
>? DATE() > {^2011/09/26} (in C# to ensure that Date Locality is not taken into account and Month is ot mixed up with Day ?)

As others have pointed out normal DateTime constructors always take int parameters in the order year,month,days,minute,second,milliseconds with overloads that allow year/month/day as a minimum.

But if, as above, you want to construct a DateTime from a string you must use DateTime.Parse and pass in information about the format of the string. Examples
  //.Parse defaults to current culture - this works if you are using UK style (day-month-year):
DateTime dt1 = DateTime.Parse("26-09-2011");
 //But  I think this is what you were looking for :
DateTime dt2 = DateTime.Parse("2011-09-26",CultureInfo.InvariantCulture);
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform