DateTime.IsLeapYear(Int32) 方法 (System)

您所在的位置:网站首页 leapyear函数作用 DateTime.IsLeapYear(Int32) 方法 (System)

DateTime.IsLeapYear(Int32) 方法 (System)

2024-06-02 04:12| 来源: 网络整理| 查看: 265

DateTime.IsLeapYear(Int32) 方法 参考 定义 命名空间: System 程序集:System.Runtime.dll 程序集:netstandard.dll 程序集:mscorlib.dll

重要

一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。

返回指定的年份是否为闰年的指示。

public: static bool IsLeapYear(int year); public static bool IsLeapYear (int year); static member IsLeapYear : int -> bool Public Shared Function IsLeapYear (year As Integer) As Boolean 参数 year Int32

四位数年份。

返回 Boolean

如果 true 是闰年,则为 year;否则为 false。

例外 ArgumentOutOfRangeException

year 小于 1 或大于 9999。

示例

下面的示例使用 IsLeapYear 方法来确定1994和2014之间的年份是闰年。 该示例还说明了 AddYears 使用方法将年份添加到闰日时的结果。

using System; public class IsLeapYear { public static void Main() { for (int year = 1994; year


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3