# all the dates of the current month

how can i diplay all the dates of the current month excluding saturdays and sundays and stop
from the current date.
sample

today is 11/27/2003

it will display all the dates of the current month
11/3/2003
11/4/2003
11/5/2003
11/6/2003
11/7/2003
11/10/2003
11/11/2003

etc..

11/24/2003
11/25/2003
11/26/2003
it will stop here because today is 11/27/2003.

pls. help

thanks!
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Hi liway,
VBScript:
Dim d, m, y
m = month(now)
y = year(now)
For i = 1 To day(now)
msgbox cdate(cstr(m) & "/" & cstr(i) & "/" & cstr(y))
Next

Regards .. Alan
0
Employee in Civil ServiceCommented:
Hi,

This one will do what you wanted -> leave saturday and sunday out!

Dim d, m, y, i, j, strg
m = Month(Now)
y = Year(Now)
For i = 1 To Day(Now)
If Weekday(CDate(CStr(m) & "/" & CStr(i) & "/" & CStr(y))) <> 1 And Weekday(CDate(CStr(m) & "/" & CStr(i) & "/" & CStr(y))) <> 7 Then
strg = strg & CDate(CStr(m) & "/" & CStr(i) & "/" & CStr(y)) & vbCrLf
End If
Next
MsgBox strg

Best regards, Raisor
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Commented:
>> excluding saturdays and sundays (Missed this bit)
VBScript:
Dim d, m, y, dt
m = month(now)
y = year(now)
For i = 1 To day(now)
dt = cdate(cstr(m) & "/" & cstr(i) & "/" & cstr(y))
if WeekDay(dt) <> 1 and day(dt) <> 2 then msgbox(dt)
Next

Regards .. Alan
0
Commented:
this is cross browser

<html>
<script language="Javascript">
function writeDates(){
var today = new Date();
today.setHours(0,0,0,0);

currentMonth = today.getMonth() + 1;
currentYear = today.getFullYear();

document.write('today is ' + currentMonth + '/' + today.getDate() + '/' + currentYear);
document.write('<br><br>');

for(i=1;i<32;i++){
var tempDate = new Date(currentMonth + '/' + i + '/' + currentYear);
if(tempDate.getTime() > today.getTime())
break;

var tempMonth = tempDate.getMonth() + 1;
var tempDay = tempDate.getDate()
var tempYear = tempDate.getFullYear();

if(tempDate.getDay() != 0 && tempDate.getDay() != 6 && tempMonth == currentMonth){
document.write(tempMonth + '/' + tempDay + '/' + tempYear + '<br>')
}
}
}
</script>
<body>
<script>writeDates();</script>
</body>
</html>
0
Commented:
change this line
if(tempDate.getTime() > today.getTime())

to this if you don't want the current date written on the last line

if(tempDate.getTime() >= today.getTime())
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.