I have a class "date.cs" in which a property modifieddate is of the type DateTime.
In another class i am trying to read a datevalue from a datagridview which is populated from the database.
The database table has milliseconds in all its date columns.
When i try to read the date value from the datagridview and assign it to the modifieddate of the date.cs class the milliseconds value doesnt get assigned because of which i am facing errors.
How do i solve this problem of fetching the milliseconds value.
My piece of code
string modDate = Convert.Todatetime(dtv.rows.cells["datecolumn"].value.tostring("yyyy-MM-dd HH:mm:ss:fff"));
Datetime getDate = DateTime.ParseExact(modDate,"yyyy-MM-dd HH:mm:ss:fff",culture);
where culture :
CultureInfo culture = System.Threading.Thread.CurrentThread.CurrentCulture;
and i assign this getDate to the modifieddate of the date.cs file.
At this time i am loosing the milliseconds part.