C#程序显示一个月中的天数
使用DaysInMonth可以显示一个月中的天数。
将年和月添加为DaysInMonth()方法的参数-
DateTime.DaysInMonth(2018, 8);
以下是一个例子-
示例
using System;
using System.Collections.Generic;
using System.Linq;
public class Demo {
public static void Main() {
Console.WriteLine("Today = {0}", DateTime.Today);
int num_days = DateTime.DaysInMonth(2018, 8);
Console.WriteLine("Days in August: "+num_days);
}
}输出结果
Today = 9/4/2018 12:00:00 AM Days in August: 31
热门推荐
10 病人祝福语老师寄语简短
11 新娘生孩子祝福语简短
12 婆婆66岁祝福语简短
13 今天孩子高考祝福语简短
14 送彩票生日祝福语简短
15 分别祝福语简短情话英文
16 画室揭牌仪式祝福语简短
17 女友妈妈生日祝福语简短
18 离别赠言离职祝福语简短