'******************************************************************************
'* 関数名:最大日数取得(GetMaxDay)
'* 引 数:年月日(ByVal w_ymdstr As String)
'* 戻り値:最大日数(String)
'* 機 能:指定した年月の月末日を取得する
'******************************************************************************
Private Function GetMaxDay(ByVal w_ymdstr As String) As String
' 12月の場合
If Mid(w_ymdstr, 6, 2) = "12" Then
' 1月1日の前日の日をセット
GetMaxDay = Format(DateValue(Format(Val(Mid(w_ymdstr, 1, 4)) + 1) & _
"/01/01") - 1, "dd")
Else
' 翌月1日の前日の日をセット
GetMaxDay = Format(DateValue(Mid(w_ymdstr, 1, 5) & Format(Val(Mid( _
w_ymdstr, 6, 2)) + 1) & "/01") - 1, "dd")
End If
End Function
|