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

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 -