Thread: vbscript help
View Single Post
Old 2008-11-11, 06:02   #6
Patrick123
 
Patrick123's Avatar
 
Jan 2006
JHB, South Africa

157 Posts
Default

The most obvious piece of code that can be optimized is

Code:
        If MyAMPM = "PM" and MYHH = "00" Then MyHH = "12" End If
        If MyAMPM = "PM" and MYHH = "01" Then MyHH = "13" End If
        If MyAMPM = "PM" and MYHH = "02" Then MyHH = "14" End If
        If MyAMPM = "PM" and MYHH = "03" Then MyHH = "15" End If
        If MyAMPM = "PM" and MYHH = "04" Then MyHH = "16" End If
        If MyAMPM = "PM" and MYHH = "05" Then MyHH = "17" End If
        If MyAMPM = "PM" and MYHH = "06" Then MyHH = "18" End If
        If MyAMPM = "PM" and MYHH = "07" Then MyHH = "19" End If
        If MyAMPM = "PM" and MYHH = "08" Then MyHH = "20" End If
        If MyAMPM = "PM" and MYHH = "09" Then MyHH = "21" End If
        If MyAMPM = "PM" and MYHH = "10" Then MyHH = "22" End If
        If MyAMPM = "PM" and MYHH = "11" Then MyHH = "23" End If
This can be changed to:

Code:
    If MyAMPM = "PM" Then
        MyHH = Str(Val(MyHH)+12)
    End If
Regards
Patrick
Patrick123 is offline   Reply With Quote