Displaying the dates of a month in simple asp

Thread: Displaying the dates of a month in simple asp

1. Senior Member
Join Date
Dec 1969
Posts
175

Displaying the dates of a month in simple asp

How do I display all the dates of a given month of a year in simple asp. I need to display them on the top of a horizontal page in a single row

2. God
Senior Member
Join Date
Dec 1969
Posts
18,177

Use a While loop.

Take the first day of month and keep adding 1 to it until you get to the next month.

3. Senior Member
Join Date
Dec 1969
Posts
175

Thanx... a bit of code help appreciated

can you help me with some code please...

4. Senior Member
Join Date
Dec 1969
Posts
1,913

No code but...

Have a look at DateAdd and DateDiff, using these and the loop that God suggested, you should not have too much trouble.<BR><BR>If you get stuck, post what code you have tried.

5. Senior Member
Join Date
Dec 1969
Posts
11,247

RE: Thanx... a bit of code help appreciated

How about<BR>Monthof = month(date)<BR>if Monthof = 12 then<BR> Month1 = 1<BR>else<BR> Month1 = Monthof +1<BR>end if<BR>lastdayofmonth = Day(DateAdd("m", -1, Month1 & "/1/2001"))

6. Senior Member
Join Date
Dec 1969
Posts
11,247

Revised

7. Senior Member
Join Date
Dec 1969
Posts
1,032

modify this ....

&nbsp;<BR>use something like :-<BR><BR><BR>function return_days(intMonth,intfullYear)<BR><BR>dim nextmonth,numberofdays,currday,strReturn<BR><BR>ne xtmonth=dateadd("m",1,"01/"+cstr(intmonth)+"/"+cstr(intfullyear))<BR><BR>numberofdays=datediff( "d","01/"+cstr(intMonth)+"/"+cstr(intfullyear),nextmonth)<BR><BR>for currday = 0 to numberofdays-1<BR><BR>strReturn=strReturn&dateadd("d",currday," 01/"+cstr(intMonth)+"/"+cstr(intfullyear))&","<BR><BR>next<BR><BR>return _days=strReturn<BR><BR><BR>end function<BR><BR><BR>response.Write return_days(2,2000)<BR><BR>jon.....

8. Senior Member
Join Date
Dec 1969
Posts
1,913

By always using 1900 as a base year, you will have problems with leap years.<BR><BR>Also (being picky), what kind of a variable is "lastdayof month" ? I take it the space is not meant to be there ;)<BR><BR>lastdayofmonth = Day(DateAdd("d", -1,DateAdd("m", 1, Month(date) & "/1/" & year(date)")))<BR>

9. Senior Member
Join Date
Dec 1969
Posts
11,247

ok ok I was nearly there

working on the fly

10. Senior Member
Join Date
Dec 1969
Posts
175

Managed but...

How do i add a separator like "," or "&#124"<BR><BR>Dim dtfr, dtto<BR>dtfr = "09/01/2002"<BR>dtto = "10/01/2002"<BR>DateFinal = DateDiff("d", dtfr, dtto)<BR><BR>Dim i<BR>For i = 1 To DateFinal<BR>Dim datelist<BR>datelist = Response.Write(i)<BR>Next

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•