VBScript: More Fun with the Date Functions - Figuring Out Which Month it is (Page 6 of 6 )
If you want to print out the name of a month (as opposed to the number, as with the Month() function), you can use the MonthName() function to do so. You can either return the full name or an abbreviated name by adding true to your code. Here is an example of how to use both methods:
<html>
<body>
<script type="text/vbscript">
document.write(MonthName(1))& "<br />"
document.write(MonthName(2))& "<br />"
document.write(MonthName(3))& "<br />"
document.write(MonthName(4))& "<br />"
document.write(MonthName(5))& "<br />"
document.write(MonthName(6))& "<br />"
document.write(MonthName(7))& "<br />"
document.write(MonthName(8))& "<br />"
document.write(MonthName(9))& "<br />"
document.write(MonthName(10))& "<br />"
document.write(MonthName(11))& "<br />"
document.write(MonthName(12))& "<br />"
document.write(MonthName(1,True))& "<br />"
document.write(MonthName(2,True))& "<br />"
document.write(MonthName(3,True))& "<br />"
document.write(MonthName(4,True))& "<br />"
document.write(MonthName(5,True))& "<br />"
document.write(MonthName(6,True))& "<br />"
document.write(MonthName(7,True))& "<br />"
document.write(MonthName(8,True))& "<br />"
document.write(MonthName(9,True))& "<br />"
document.write(MonthName(10,True))& "<br />"
document.write(MonthName(11,True))& "<br />"
document.write(MonthName(12,True))& "<br />"
</script>
</body>
</html>
And here is the result:
January
February
March
April
May
June
July
August
September
October
November
December
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
Well that's it for this article. Be sure to join us next time, when we pick up where we left off and work our way through the rest of the VBScript Date functions.
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. |