DateTime formatting
Hello Everyone,
I am trying to pass two dates to a stored procedure in SQL server. I only require the date protion of the input not the time, but I cannot seem to get the formatting to just mm/dd/yyyy
the data is collected from two text boxes on a web form and is imput as string in the format mm/dd/yyyy.
The SP is expecting datetime parameters.
I have tried so many variations to this I am wondering if it can even be done????
DateTime FromDate = DateTime.ParseExact(tempdt, "mm/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture);
DateTime Todate = Convert.ToDateTime(ToDateLbl.Text);
None of these work.
All help grealy accepted.
Kumar DuvvarapuPosted Nov 22, 2006, 6:40 AM
DateTime dt = DateTime.Parse(dateString);
string onlyDate = dt.ToString("mm/dd/yyyy");
hope this may help you
thanks and regards,
kumar