Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Comparing Dates in C#
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01524808
Message ID:
01524936
Views:
56
>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);
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform