Created
August 20, 2009 16:32
-
-
Save nickmartini/171176 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string BuildDateDirectory() | |
{ | |
string year = DateTime.Now.Year.ToString(); | |
string month = DateTime.Now.Month.ToString(); | |
string day = DateTime.Now.Day.ToString(); | |
string hour = DateTime.Now.Hour.ToString(); | |
string minute = DateTime.Now.Minute.ToString(); | |
if (month.Length == 1) | |
month = string.Format("0{0}", month); | |
if (day.Length == 1) | |
day = string.Format("0{0}", day); | |
if (hour.Length == 1) | |
hour = string.Format("0{0}", hour); | |
if (minute.Length == 1) | |
minute = string.Format("0{0}", minute); | |
return string.Format("{0}-{1}-{2} {3}{4}", year, month, day, hour, minute); | |
} | |
VERSUS | |
DateTime.Now.ToString("yyyy-MM-dd HHmm"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment