📄 modold.bas
字号:
Attribute VB_Name = "ModOld"
'****************************************************************************
'人人为我,我为人人
'枕善居汉化收藏整理
'发布日期:2007/05/02
'描 述:小型企业进销存源代码
'网 站:http://www.Mndsoft.com/ (VB6源码博客)
'网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
'计年龄
Public Old '年龄
Public Function ExactAge(BirthDate As Variant) As String
Dim yer As Integer, mon As Integer, d As Integer
Dim dt As Date
Dim sAns As String
If Not IsDate(BirthDate) Then Exit Function
dt = CDate(BirthDate)
If dt > Now Then Exit Function
yer = Year(dt)
mon = Month(dt)
d = Day(dt)
yer = Year(Date) - yer
mon = Month(Date) - mon
d = Day(Date) - d
If Sgn(d) = -1 Then
d = 30 - Abs(d)
mon = mon - 1
End If
If Sgn(mon) = -1 Then
mon = 12 - Abs(mon)
yer = yer - 1
End If
sAns = yer & " year(s) " & mon & " month(s) " & d _
& " day(s) old."
ExactAge = sAns
Old = yer
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -