var DateTemp = new Date()
This looks like javascript; if you want to use vbscript, do it like this (this is just masirof's idea, spelled out a bit further)
<%
Dim sMyDate ' m/d/yyyy format
Dim sNewDate ' mm/dd/yyyy format
Dim sDay
Dim sMonth
sMyDate = "4/1/2000"
sDay = day(sMyDate)
sMonth = month(sMyDate)
if len(sDay)=1 then
sDay = "0"&sDay
end if
if len(sMonth)=1 then
sMonth = "0"&sMonth
end if
sNewDate = sMonth & "/" & sDay & "/" & year(sMyDate)
response.write "Day before conversion: "&sMyDate
response.write "Day after conversion: "&sNewDate
%>
Hope this helps!
peh803
Main Topics
Browse All Topics





by: masirofPosted on 2004-11-09 at 08:38:45ID: 12535123
First split into day month year
and check by LEN if its 2 digits or not, like
if Len(varDAY) = 1 Then varDAY = "0" & varDAY
and join them together :D