VBScript: Final Date Functions - The TimeValue() Function (Page 5 of 5 )
This function returns a time that you specify, ranging from 0:00:00 (aka 12:00:00 AM) to 23:59:59 (aka 11:59:59 PM). Here is an example:
<html>
<body>
<script type="text/vbscript">
document.write(TimeValue("10:15:25")) & "<br />"
document.write(TimeValue("10:15:25 PM")) & "<br />"
document.write(TimeValue("22:15:25")) & "<br />"
document.write(TimeValue(#10:15:25 PM#)) & "<br />"
document.write(TimeValue("10:15"))& "<br />"
</script>
</body>
</html>
Resulting in:
10:15:25 AM
10:15:25 PM
10:15:25 PM
10:15:25 PM
10:15:00 AM
Weekday() and WeekdayName()
These two functions return the day of week, as a numeric value (1-7) and the weekday name, respectively:
<html>
<body>
<script type="text/vbscript">
document.write(Weekday(Date)) & "<br />"
document.write("Here we give weekday a value: ") &(Weekday(2))& "<br />"
document.write(WeekdayName(Weekday(Date))) & "<br />"
document.write(WeekdayName(Weekday(Date),true)) & "<br />"
document.write(WeekdayName(4))
</script>
</body>
</html>
And the final result:
3
Here we give weekday a value: 2
Tuesday
Tue
Wednesday
Ok, so I lied. We didn't get to the Format() functions after all. We will however get to them in a future article...maybe even the next. So check back often...or else!
Till then...
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |