Home and Blog button

Pages

Introduction

Welcome To my Blog !!
This is a blog where you can get some knowledge that i have learned and been using. Sharing is gaining pals. So Happy Sharing and don't forget to follow and link my blog with yours! Thanks.
Happy Programming!!

Wednesday, July 1, 2009

Use of Date function in VBscript!!

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

Search This Blog