VBScript MonthName Function


Advertisements

The MonthName function returns the name of the month for the specified date.

Syntax

MonthName(month[,toabbreviate]) 

Parameter Description

  • Month, a Required Parameter. It specifies the number of the month.

  • toabbreviate, an Optional Parameter. A Boolean value Boolean value that indicates if the month name is to be abbreviated. If left blank, the default value would be taken as False.

Example

<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         document.write("Line 1 : " & MonthName(01,True) & "<br />")
         document.write("Line 2 : " & MonthName(01,false) & "<br />")
          
         document.write("Line 3 : " & MonthName(07,True) & "<br />")
         document.write("Line 4 : " & MonthName(07,false) & "<br />")
          
      </script>
   </body>
</html>

When you save it as .html and execute it in Internet Explorer, then the above script will produce the following result −

Line 1 : Jan
Line 2 : January
Line 3 : Jul
Line 4 : July
vbscript_date.htm
Advertisements