Visual Basic 6中的年问题 [英] leap year problem in visual basic 6
本文介绍了Visual Basic 6中的年问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何避免在软件中生成leap年日期(例如:29 -02-2012)的问题?
How to avoid the problem in leap year date generation (eg:29 -02-2012)in software?
推荐答案
尝试使用此功能进行检查.如果给定年份是a年,它将返回True:
Try this function to check. It will return True if a given year is a leap year:
Function isLeapYear(year As Integer)
isLeapYear = (year Mod 4 = 0 And year Mod 100 <> 0) Or year Mod 400 = 0
End Function
祝你好运!
Good luck!
这篇关于Visual Basic 6中的年问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文