2007年11月17日土曜日

[VB]月末日付取得

'*** 月末日付を取得します ***
' 変換できなかった場合は0を返します。
Public Function 月末日付(ByVal strMonth)
'*** 月末日付を取得します ***
' 変換できなかった場合は0を返します。
Public Function 月末日付(ByVal strMonth)
  Dim dt As DateTime = DateTime.Now
  月末日付 = 0
  On Error Resume Next
  月末日付 = Date.DaysInMonth(dt.Year, strMonth)
End Function

時間数値化と同じ内容のときにあったものです。
俺がなかったら今頃この仕事やめてます。
ウソですw
.NETと書いているけれどVBでも使えるはずです。
元はExcelVBAなんで。

0 件のコメント: