I am working in an application built in .NET framework 2.0 but I am running it in .NET framework 4.0, with SQL server as a database.
when I try to take date as a input from Calendar controller (Webforms) its in the format dd/MM/yyyy and this application using Convert.ToDateTime() to parse this date and it throws exception.
so how can I resolve this problem and is there any way that DateTime class object store the date in specific format means I want to store date in dd/MM/yyyy format even when I copy this date object to another, then both object should have same format.
and sorry for My English :p
Assuming you mean this Calendar
control, you should just use the SelectedDate
or SelectedDates
property - let the control handle the conversions.
In general, you should avoid performing textual conversions unless you really need to. (This includes when you interact with the database - use parameterized SQL, and simply pass the DateTime
values in the parameters.)
See more on this question at Stackoverflow