年份函数 (Visual Basic for Applications)

您所在的位置:网站首页 year函数使用格式 年份函数 (Visual Basic for Applications)

年份函数 (Visual Basic for Applications)

2024-05-08 13:24| 来源: 网络整理| 查看: 265

年份函数 项目04/07/2023

返回包含表示年的整数的变量(整数)。

语法

年份 (日期)

所需的 日期参数 是可以表示日期的任何 Variant、 数值表达式、 字符串表达式或任何组合。 如果 date 包含 Null,则返回 Null。

注意

如果 Calendar 属性设置为 Gregorian,则返回的整数表示日期参数的公历年份。 If the calendar is Hijri, the returned integer represents the Hijri year for the date argument. For Hijri dates, the argument number is any numeric expression that can represent a date and/or time from 1/1/100 (Gregorian Aug 2, 718) through 4/3/9666 (Gregorian Dec 31, 9999).

示例

This example uses the Year function to obtain the year from a specified date. 在开发环境中,使用代码的区域设置以短日期格式显示日期文本。

Dim MyDate, MyYear MyDate = #February 12, 1969# ' Assign a date. MyYear = Year(MyDate) ' MyYear contains 1969. 另请参阅 函数 (Visual Basic for Applications) 支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。



【本文地址】


今日新闻


推荐新闻


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