Dear All,
I have done some code in VBScript so that if the date is displayed in the 7/7/2002, or 8/8/2002 format for example, I change that in 07/07/2002 and 08/08/2002 respectively. This is so that I can do some validation on the fields. Now I wish to change the code that I will paste here into a Javascript function so that I can use it in more Asp's just by calling this function. Can you please tell me how I can do that since I am a newbie in Javascript.
Here is the VBScript code:-
------------------------------------------------------
DBDate = rs("newsDate"
slash = Instr(DBdate, "/"
strMonth = mid(DBdate, 1, slash-1)
rest = mid(DBdate, slash+1, len(date))
slash2 = Instr(rest, "/"
strDay = mid(rest, 1, slash2-1)
strYear = mid(rest, slash2+1, len(rest))
if strMonth < 10 then
strMonth = "0" & strMonth
end if
if strDay < 10 then
strDay = "0" & strDay
end if
DBDateFormat = strMonth & "/" & strday & "/" & strYear
-------------------------------------------------------
THanks for your help!
I have done some code in VBScript so that if the date is displayed in the 7/7/2002, or 8/8/2002 format for example, I change that in 07/07/2002 and 08/08/2002 respectively. This is so that I can do some validation on the fields. Now I wish to change the code that I will paste here into a Javascript function so that I can use it in more Asp's just by calling this function. Can you please tell me how I can do that since I am a newbie in Javascript.
Here is the VBScript code:-
------------------------------------------------------
DBDate = rs("newsDate"
slash = Instr(DBdate, "/"
strMonth = mid(DBdate, 1, slash-1)
rest = mid(DBdate, slash+1, len(date))
slash2 = Instr(rest, "/"
strDay = mid(rest, 1, slash2-1)
strYear = mid(rest, slash2+1, len(rest))
if strMonth < 10 then
strMonth = "0" & strMonth
end if
if strDay < 10 then
strDay = "0" & strDay
end if
DBDateFormat = strMonth & "/" & strday & "/" & strYear
-------------------------------------------------------
THanks for your help!