Getting the Name of the Current Month using the MonthName function

Below is of snippet of code that will return the name of the current month using the MonthName VBScript function. In the code below the Month function will return a number between 1 and 12 based on the date function. Next the MonthName function will return the corresponding month name based on the argument between 1 and 12.

<%
Response.Write MonthName(month(date))
%>

Below is our code in action:
March

If you wanted to shorten the month name returned just use the extra parameter below.

<%
Response.Write MonthName(month(date), true)
%>

Below is our code in action:
Mar



Find out how to get the name of the current day

Other date and time related tutorials:
Read more on the Date, Time and Now VBScript functions
Here's a code snippet to display the day and date (eg. Mon 25 December).
Here's a code snippet to display the day and date with the ordinal suffix (eg. Mon 25th December).
Display the dates and times
Time and Date based greetings
The DateDiff DateAdd and DatePart Functions

Advertisements



MembersPro

MembersPro PayPal - ASP Membership software

Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.

Get your best asp web hosting provider now and save 25%