Trouble parsing string to date c# (from sqlite database) -
i modeled solution on answers many other posts still not work.
public void dtparsing() { string date = "2016-04-19 15:14:19.597"; console.writeline("date c# string : {0} : ", date); string pattern = "yyyy-m-d h:m:s.f"; datetime mydate = datetime.parseexact(date, pattern, null); console.writeline("\ndate c# datetime : {0} : ", mydate.tostring()); console.readkey(); }
one problem values not set number of digits: milliseconds can anywhere 0 3 digits. there solution without parsing more manual parsing?
this should stop error (no need pattern, must match exactly)
datetime mydate = convert.todatetime(date);
Comments
Post a Comment