Solved

# Invalid procedure call or argument: 'weekdayname'

Posted on 2003-03-04
Medium Priority
510 Views
strDaysTaken=DateDiff("d",strDateFrom,strDateTo)+1
strDays=strDaysTaken

'puts the week day names frm start to end date in a array
'----------------===========================------
i=1
temp1 = 1
ReDim daysOfWeek(strDaysTaken)
do while temp1<= strDays
temp2 = (weekdayname(temp1,,weekday(strDateFrom)))
'for i = 1 to strDays
daysOfWeek(i)= temp2
Response.Write(daysOfWeek(i))
'next
i=i+1
temp1=temp1+1
loop
'----------------===========================--------

People, i've gt a challenge.. i get the error "Invalid procedure call or argument: 'weekdayname'" whenever i enter the dates strDateFrom and strDateTo in multiples of 7 OR sometimes more than 7 days, can someone please help me?
0
Question by:wuranma
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 8
• 7

LVL 1

Expert Comment

ID: 8069402
weekdayname(weekday[,abbrevoate])

weekday: 1 to 7
abbrevoate: true/false

Hero
0

Author Comment

ID: 8069418
uhm.. why wuld i nd the boolean value? if i do.. hw do i use it? i haf weekday(strDateFrom) so i can use tat as the value to indicate the first day of the week..
0

LVL 1

Expert Comment

ID: 8069421
typing wrong!
It should be abbreviate, not abbrevoate.

abbreviate is optional.
0

Author Comment

ID: 8069432
nahz..still dun get it.. i need concrete help on how to solve my problem..
0

LVL 1

Expert Comment

ID: 8069437
For example:

Assume strDateFrom = "01/03/2003" (dd/mm/yyyy)

weekday(weekday(strDateFrom))
> Monday

weekday(weekday(strDateFrom), true)
> Mon

weekday(weekday(strDateFrom), false)
> Monday

See?

Hero
0

LVL 1

Expert Comment

ID: 8069444
Sorry.....
previous one is something wrong!
try again.

For example:

Assume strDateFrom = "01/03/2003" (dd/mm/yyyy)

weekdayname(weekday(strDateFrom))
> Monday

weekdayname(weekday(strDateFrom), true)
> Mon

weekdayname(weekday(strDateFrom), false)
> Monday

See?

Hero
0

Author Comment

ID: 8069475
blurr here.., but the problem i have now is this

do while temp1<= strDays
temp2 = (weekdayname(temp1,,weekday(strDateFrom)))
temp1 is the counter and the var i use to act as 1-7 for each day of the week. weekday(strDateFrom) is wat i use to define which day starts from it..

so lets say i enter 03/11/03 to 03/18/03, it prints out Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday,Monday but not the next tuesday, which is 03/18/03.the 8th number.
0

LVL 1

Accepted Solution

herongan earned 100 total points
ID: 8069497
See it work or not.

====================================

strDaysTaken=DateDiff("d", "01 March, 2003", "04 March, 2003")
strDays=strDaysTaken

'puts the week day names frm start to end date in a array
'----------------===========================------
i=0
temp1 = 0
ReDim daysOfWeek(strDaysTaken)
do while temp1<= strDays
temp2 = weekdayname(weekday(DateAdd("d", temp1, "01 March, 2003")))
'for i = 1 to strDays
daysOfWeek(i)= temp2
Response.Write(daysOfWeek(i))
'next
i=i+1
temp1=temp1+1
loop

====================================

Hero
0

LVL 1

Expert Comment

ID: 8069512
Oh!...
If not inculde next tuesday,
you should change somethings.

strDaysTaken=DateDiff("d", "01 March, 2003", "04 March, 2003") - 1

need -1.

Hero
0

Author Comment

ID: 8069531
hm.. the first one worked but printed a extra wednesday, if i used 03/11/03 - 03/18/03 which is a tuesday to tuesday.
but if i used the 2nd one where i minus one, the days in between will only be 4 days, missing alot of days...
but we're on the right track there
0

Author Comment

ID: 8069549
oopz! forgot my thankz! i'll try to figure and get rid of the extra day..
0

LVL 1

Expert Comment

ID: 8069550
the date format should "dd/mm/yyyy"
The output is ok.
try it again.

=========================================================
strDaysTaken=DateDiff("d", "11/03/2003", "18/03/2003") - 1
strDays=strDaysTaken

'puts the week day names frm start to end date in a array
'----------------===========================------
i=0
temp1 = 0
ReDim daysOfWeek(strDaysTaken)
do while temp1<= strDays
'for i = 1 to strDays
daysOfWeek(i)= temp2
Response.Write(daysOfWeek(i))
'next
i=i+1
temp1=temp1+1
loop
=========================================================

Hero
0

Author Comment

ID: 8069566
hm.. it oni prints out tuesday to monday, and excluding both weekends, i shuld have 6 days includin both tuesday, bt i oni get 4 days for this..
the first one seems to work betta u knw?
0

LVL 1

Expert Comment

ID: 8069588
Maybe i got something wrong.

Anyway, the important thing is you can solve your problem.
Rigth?
(n_n)
0

Author Comment

ID: 8069756
gee! yupz! thankz! =p
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is tâ€¦
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interactâ€¦
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on tâ€¦
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a qâ€¦
###### Suggested Courses
Course of the Month13 days, 13 hours left to enroll