c# - DateTime.Parse Not Parsing -
i'm trying return date "2015-06-18"
string strdate = datetime.now.tostring("yyyy-mm-dd"); datetime newdate = datetime.parse(strdate);
this returns "2015/06/18 hh:mm:ss"
what missing?
if want particular output format, can specify 1 yourself.
string strdate = datetime.now.tostring("yyyy-mm-dd"); datetime newdate = datetime.parse(strdate); string output = newdate.tostring("yyyy-mm-dd"); console.writeline (output); // produces 2015-06-18 right
the datetime
structure in .net includes time of day, , there no built-in way store date, if want exclude it, you'll need use formatting options.
Comments
Post a Comment