请问有没有判断一个月是几天的函数 在线等待回复,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 好像沒有,以下是我自已寫的Public Function MaxDay(Year As Integer, Month As Integer) As Integer If Month > 0 And Month < 13 Then If IsDate(Year & "/" & Month & "/" & 31) Then MaxDay = 31 ElseIf IsDate(Year & "/" & Month & "/" & 30) Then MaxDay = 30 ElseIf IsDate(Year & "/" & Month & "/" & 29) Then MaxDay = 29 Else MaxDay = 28 End If Else MaxDay = 0 End If End FunctionPublic Function LastDay(ByVal Year As Integer, ByVal Month As Integer) As Date If Month > 0 And Month < 13 Then If IsDate(Year & "/" & Month & "/" & 31) Then LastDay = DateSerial(Year, Month, 31) ElseIf IsDate(Year & "/" & Month & "/" & 30) Then LastDay = DateSerial(Year, Month, 30) ElseIf IsDate(Year & "/" & Month & "/" & 29) Then LastDay = DateSerial(Year, Month, 29) Else LastDay = DateSerial(Year, Month, 28) End If Else LastDay = 0 End If End Function Day(CDate(Trim(Str((Year(Now)))) & "-" & Trim(Str(Month(Now) + 1)) & "-1") - 1) 下列函数计算 mydate 所在的月份的天数:Public Function Month_Days(ByVal mydate As Date) As IntegerDim startday, endday As Datestartday = Format(mydate, "yyyy-mm-01")endday = DateAdd("m", 1, startday)Month_Days = DateDiff("d", startday, endday)End Function Day(CDate(Trim(Str((Year(Now)))) & "-" & Trim(Str(Month(Now) + 1)) & "-1") - 1)这个代码明显有问题嘛,楼主竟然给了30分。你看看十二月份的日期加一都成了13月了! 关于SetFilePointer在大于2g的文件中的定位 怎样获取系统图标? sendkey中方向键怎么表示? 请问如何将Datagrid控件里的数据用MSchart控件显示出来? 备份数据库出错,请帮忙看看! 谁知道 vb5 时代一个叫 xing 的人 在VB5中如何控制在DBgrid显示的列数? 散分 时效问题:请问谁在看春节晚会?觉得怎么样? 用过winzip和WinRaR之后觉得对于数据库压缩比例都很大,可是对于jpg在怎么使劲还是........ 求数据库操作的通用函数 请高手指点(在线等)
If Month > 0 And Month < 13 Then
If IsDate(Year & "/" & Month & "/" & 31) Then
MaxDay = 31
ElseIf IsDate(Year & "/" & Month & "/" & 30) Then
MaxDay = 30
ElseIf IsDate(Year & "/" & Month & "/" & 29) Then
MaxDay = 29
Else
MaxDay = 28
End If
Else
MaxDay = 0
End If
End FunctionPublic Function LastDay(ByVal Year As Integer, ByVal Month As Integer) As Date
If Month > 0 And Month < 13 Then
If IsDate(Year & "/" & Month & "/" & 31) Then
LastDay = DateSerial(Year, Month, 31)
ElseIf IsDate(Year & "/" & Month & "/" & 30) Then
LastDay = DateSerial(Year, Month, 30)
ElseIf IsDate(Year & "/" & Month & "/" & 29) Then
LastDay = DateSerial(Year, Month, 29)
Else
LastDay = DateSerial(Year, Month, 28)
End If
Else
LastDay = 0
End If
End Function
Public Function Month_Days(ByVal mydate As Date) As Integer
Dim startday, endday As Date
startday = Format(mydate, "yyyy-mm-01")
endday = DateAdd("m", 1, startday)
Month_Days = DateDiff("d", startday, endday)
End Function
这个代码明显有问题嘛,楼主竟然给了30分。你看看十二月份的日期加一都成了13月了!