SamKr
10/13/2015 - 12:51 PM

Nice DateTime

Nice DateTime

public static string getNiceDateTime()
{
    var year = DateTime.Now.Year.ToString();
    var month = DateTime.Now.Month.ToString();
    var day = DateTime.Now.Day.ToString();
    var hour = DateTime.Now.Hour.ToString();
    var minute = DateTime.Now.Minute.ToString();

    if (month.Length == 1) { month = "0" + month; }
    if (day.Length == 1) { day = "0" + day; }
    if (hour.Length == 1) { hour = "0" + hour; }
    if (minute.Length == 1) { minute = "0" + minute; }

    return year + "." + month + "." + day + " " + hour + ":" + minute;
}