DateTime now = new DateTime(2006, 9, 07, 15, 06, 01, 08, DateTimeKind.Local); now.ToString(); //"09/27/2006 15:06:01"
Year
now.ToString("%y"); //"6" now.ToString("yy"); //"06" now.ToString("yyy"); //"2006" now.ToString("yyyy"); //"2006"
Month
now.ToString("%M"); //"9" now.ToString("MM"); //"09" now.ToString("MMM"); //"Sep" now.ToString("MMMM"); //"September"
Day
now.ToString("%d"); //"7" now.ToString("dd"); //"07" now.ToString("ddd"); //"Thu" now.ToString("dddd"); //"Thursday"
Hour
now.ToString("%h"); //"3" now.ToString("hh"); //"03" now.ToString("hhh"); //"03" now.ToString("hhhh"); //"03" now.ToString("%H"); //"15" now.ToString("HH"); //"15" now.ToString("HHH"); //"15" now.ToString("HHHH"); //"15"
Minutes
now.ToString("%m"); //"3" now.ToString("mm"); //"03" now.ToString("mmm"); //"03" now.ToString("mmmm"); //"03"
Seconds
now.ToString("%s"); //"1" now.ToString("ss"); //"01" now.ToString("sss"); //"01" now.ToString("ssss"); //"01"
Milliseconds
now.ToString("%f"); //"0" now.ToString("ff"); //"00" now.ToString("fff"); //"008" now.ToString("ffff"); //"0080" now.ToString("%F"); //"" now.ToString("FF"); //"" now.ToString("FFF"); //"008" now.ToString("FFFF"); //"008"
Kind
now.ToString("%K"); //"-07:00" now.ToString("KK"); //"-07:00-07:00" now.ToString("KKK"); //"-07:00-07:00-07:00" now.ToString("KKKK"); //"-07:00-07:00-07:00-07:00"
(Source)