Checking validity of date and Using each date's day, month and year.
Source Code.
<html>
<head><title>vbscript - Check date!</title>
<script language =vbscript>
Dim StoredDate
document.write("<b>Today's Date is: " & Date & "</b><hr>")
Sub bttnconvert_OnClick()
If Not IsDate(document.form1.txtdate.value) Then
msgbox("Invalid Date!!")
document.form1.txtdate.value = ""
else
StoredDate = document.form1.txtdate.value
document.form1.txtres.value = day(StoredDate) & "-" & month(storeddate) & "-" & year(storeddate)
End if
End Sub
</script>
</head>
<body>
<form name="form1">
<input type="text" name="txtdate" value="">
<input type="button" name="bttnConvert" value="Convert Date Format"><br>
<input type="text" name="txtres" value="">
<input type="Reset" name="Reset" value="Clear"><br>
</form>
</body>
</html>
No comments:
Post a Comment