Displaying the Day and the Date

As you can see just below our navigation bar on the far right is the current day and date of our server. Below is the ASP(VBScript) code that produces this. Just copy and paste this into your page.

<%
Dim strDay
Dim strMonth
strDay=(weekday(date))
Select Case strDay
case 1 Response.write("Sunday")
case 2 Response.write("Monday")
case 3 Response.write("Tuesday")
case 4 Response.write("Wednesday")
case 5 Response.write("Thursday")
case 6 Response.write("Friday")
case 7 Response.write("Saturday")
End Select
Response.Write(" "&day(date)&" ")

strMonth=(month(date))
Select Case strMonth
case 1 Response.write("January")
case 2 Response.write("February")
case 3 Response.write("March")
case 4 Response.write("April")
case 5 Response.write("May")
case 6 Response.write("June")
case 7 Response.write("July")
case 8 Response.write("August")
case 9 Response.write("September")
case 10 Response.write("October")
case 11 Response.write("November")
case 12 Response.write("December")
End Select
%>

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 with the ordinal suffix (eg. Mon 25th December).
How to get the current month name
Display the dates and times
Time and Date based greetings
IsDate Function
The DateDiff DateAdd and DatePart Functions

Get the best asp web hosting provider now and save 30%

Advertisements



MembersPro

MembersPro PayPal - ASP Membership software

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

Free ASP Hosting