.net - set datetimepicker in c# windows -


how can set date , time datetimepicker stored in database , in "2013-04-04 04:27:16.000" format

the column in database 'datetime' format.

if have datetime string:

var converter = typedescriptor.getconverter(typeof(datetime)); var result = converter.convertfrom(datetimestring); datetime value = (datetime)result; datetimepicker.value = value; 

or use datetime.parse or tryparse

or can database datetime

datetime? dt =row.field<datetime?>(columnname); if(dt.hasvalue) datetimepicker.value = dt.getvalueordefault(); 

where row datarow got database


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -