CodeAve.com CodeAve.com - ASP - Miscellaneous
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


Current Month Calendar
The .asp current month calendar will display the current month and highlight the current date according to the date on the server. Parameters are set to define the number of days for the current month, the value of the first day of the month and a loop is created to display the first week with blanks in the weekdays for the previous month. A second loop fills in the remaining days of the month and inserts blanks in the weekdays for the beginning of the new month. A simple tautology is placed inside each loop to place the current date in bold type. Logic is also applied to be certain February has the correct number of days according to the Gregorian calendar.
View the Output
Text View
Print View
Mail this Link
Download the Code

<html>
<title>Current Month Calendar</title>
<body bgcolor="#FFFFFF">
<%
dim current_date, first_day, this_date
dim counter,days, weeks, current_year

' Create an array to display the month names
dim month_name(12)
month_name(1)="January "
month_name(2)="February "
month_name(3)="March "
month_name(4)="April "
month_name(5)="May "
month_name(6)="June "
month_name(7)="July "
month_name(8)="August "
month_name(9)="September "
month_name(10)="October "
month_name(11)="November "
month_name(12)="December "

' create a varible for the current date
current_date=date()

' create a varible for the current year from the current date
current_year=year(current_date)

' create a varible for the current day from the current date
this_date=day(current_date)

' create a varible for the current month from the current date
month_number=month(current_date)

' create a varible for the first day from the current date
first_day=weekday(dateSerial(current_year,month_number,01))

' create a varible for the length of the current month
select case month_number
' For the months with 31 days set the end date
case "1","3","5","7","8","10","12"
last_day=31

' For February set the end date by applying the leap year rules
' if the year is evenly divisable by 4 or ending in 00 divisable by 400

case "2"
last_day=28

right_year_divided=current_year/4
if right_year_divided = cint(right_year_divided) then
last_day=29
end if

if right(current_year,2)="00" then
right_year_divided=current_year/400

if right_year_divided = cint(right_year_divided) then
last_day=29
end if ' end check of year values
end if ' end check for new century

' All the rest of the months have 30 days
case else
last_day=30
end select ' end selct of month

%>
<html>
<body bgcolor="#FFFFFF">
<table border=1 align=center>
<caption><b><%= month_name(month_number) & current_year %></b></caption>
<tr><th>S</th><th>M</th><th>T</th><th>W</th>
<th>Th</th><th>F</th><th>Sa</th></tr>
<tr>
<%
' Loop for the 1st week of the month
for counter = 1 to 7 %>

<td><%
' Check to see what day the first of the month falls on
if counter > first_day-1 then

' Count for days
days=days+1

' Check to see if the current date is in the 1st week
' if so place it in bold type
if days=this_date then
response.write "<b>" & days & "</b>"
else
response.write days
end if ' End check for current date
end if ' End check for first day of the week
%>
</td><%
next %>

</tr>
<%
' Loop for the remaining weeks in the month
for weeks = 1 to 5 %>

<tr>
<%
' Loop of the remaing days of the month
for counter = 1 to 7

' Count for days
days=days+1

' Write out the date and place in bold if it's the current date
if days <= last_day then
%>
<td><%
if days=this_date then
response.write "<b>" & days & "</b>"
else
response.write days
end if ' End check for current date
%>
</td>
<% end if ' End check for end of month
next %>

</tr><%
next %>

</table>
</body>
</html>

 

 

 



ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3