c# - How can I format a date? -
c# - How can I format a date? -
//this month int (e.g. 4) datetime dlastmonth = datetime.today.addmonths(-1); int ilastmonth = dlastmonth.year;
how can create above code output 01, 02, etc... instead of 1, 2, 3...
i'm confused question, if want format string (01, 02, 03 etc) use:
var formatted = ilastmonth.tostring("d2") console.writeline(formatted);
c# .net date format
Comments
Post a Comment