时间:2020-11-24 16:58:46 | 栏目:.NET代码 | 点击:次
格式要求:
calender = string.Format(calender, fd).TrimEnd();
Console.WriteLine(calender);
}
}
class formatDate : IFormattable
{
int num;
int max;
public formatDate(int year, int month)
{
DateTime dt = new DateTime(year, month, 1);
num = (int)dt.DayOfWeek * -1;
max = DateTime.DaysInMonth(year, month);
}
public string ToString(string format,IFormatProvider formatProvider)
{
return num++ < 0 || num > max ? " " : num.ToString("00");
}
}