精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● VB和Basic>>〓〓..各种开发技巧..〓〓>>算法、技巧和其他>>求某个月最后一天的最简算法

主题:求某个月最后一天的最简算法
发信人: goldeagle()
整理人: winsy(2003-03-05 16:32:51), 站内信件
刚才看精华区的时候发现其中收录了我写的以下函数:

Public Function LastDayOfMonth(Year As Integer, Month As Integer)
   LastDayOfMonth = DateAdd("d", -1, _
      DateAdd("m", 1, DateSerial(Year, Month, 1))) 
End Function 

我记得我后来又写了一个更好的函数(我认为是最简单的),功能相同:

Public Function LastDayOfMonth(Year As Integer, Month As Integer)
    LastDayOfMonth = DateSerial(Year, Month + 1, 0)
End Function

希望斑竹更新精华区中的相关内容,多谢。

--
行侠仗义吾本性,展翅翱翔天地间
请加入我创建的邮件列表“金鹰的程序员天地”:
(发一封空邮件到 [email protected]
再回复一封确认信就可以了)

※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.103.182.36]

[关闭][返回]