Thursday, May 28, 2009

VB Functions for mm/dd/yyyy

Private Function getMonth(tmpDate As String) As Integer
    Dim tmpMonth As String
    Dim tmpMonthLoc As Integer
    tmpMonthLoc = InStr(1, tmpDate, "/")
    getMonth = Mid(tmpDate, 1, tmpMonthLoc - 1)
End Function
Private Function getDay(tmpDate As String) As Integer
    Dim tmpDay As String
    Dim tmpDayLoc As Integer
    tmpDayLoc = InStr(1, tmpDate, "/")
    getDay = Mid(tmpDate, tmpDayLoc + 1, Len(tmpDate) - 5 - tmpDayLoc)
End Function
Private Function getYear(tmpDate As String) As Integer
    getYear = Right$(tmpDate, 4)
End Function

No comments: