Stupid questions but cant get my head around it... I have a string in this format 20081119
And I have a C# method that converts the string to a DateTime to be entered into a SQL Server DB
public static DateTime MyDateConversion(string dateAsString)
{
return System.DateTime.ParseExact(dateAsString, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
}
The problem is that the Date is coming out like this: Date = 19/11/2008 12:00:00 AM and I need it to be a DateTime of type yyyyMMdd as I am mapping it into a schema to call a stored proc.
Thanks in advance guys.
Cheers, Con
See Question&Answers more detail:os