c# - How to convert smalldatetime retrieved from database back to smalldatetime to be reposted to the database -



c# - How to convert smalldatetime retrieved from database back to smalldatetime to be reposted to the database -

i have form takes item database of "smalltime" type , re add together database "smalldatetime" problem ran is reading item string. not sure approach take convert here have far:

var checkoutdate = convert.todatetime(ddlcheckoutdate.text); sl.reqcheckoutdate = checkoutdate;

can help me on hurdle?

the issue reporting due civilization difference. using formatted date , current civilization set uk or similar thinks using day/month/year , makes 12/14/2013 day=12 month=14 year=2013 , hence invalid.

using datetime.parseexact allow command exact conversion of date:

cultureinfo provider = cultureinfo.invariantculture; string dateastext = "12/14/2012 12:00:00 pm"; datetime = datetime.parseexact(dateastext, "mm/dd/yyyy hh:mm:ss tt", provider);

c# sql visual-studio

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -