Swap Your Date

Do you want to swap a date from mm-dd-yy format to dd-mm-yy following function will be help for you..

Private Function SwapDate(byVal dateinput)
Dim strDate, strTmpArray, strFinalDate, del, intCtr
strDate = dateinput
If instr(strDate, “/”) Then
strTmpArray = split( strDate, “/” )  :  del = “/”
    Elseif instr(strDate, “-“) Then
strTmpArray = split( strDate, “-” )  :  del = “-”
    Elseif instr(strDate, ” “) then
strTmpArray = split( strDate, ” ” )  :  del = ” ”
    End if
    For intCtr = 0 to ubound(strTmpArray)
strTmpArray( intCtr ) = replace( strTmpArray( intCtr ), “,”, “” )
    Next
strFinalDate = strTmpArray(1) & del & strTmpArray(0)
    if del = ” ” then strFinalDate = strFinalDate & “,”
strFinalDate = strFinalDate & del & strTmpArray(2)
SwapDate = Trim( strFinalDate )
End Function

The code is so easy to comprehend I didn’t supplied the remarks.

Did it worked please tell me…

Cheers 🙂