I have to get the name of the directory based on the following pattern: two final digits of the month (two digits in a month included ). For example, the directory "1009" will be from September 2010.
I did this, but I found my code very wasted. How can I improve it?
My current code:
Public string GetDirectoryNameFromDate (DateTime Date) {StringBuilder sb = New StringBuilder (); Sb.Append (. Date.Year.ToString () substrings (2)); Int month = date Death; If (month and lieutenant; 10) {sb.Append ("0"); } Sb.Append (month.ToString ()); Return sb.ToString (); }
Thanks for the advice!
It should be quite easy. Use
Date. Toasting ("yyMM");
Comments
Post a Comment