?
Solved

Invalid procedure call or argument: 'weekdayname'

Posted on 2003-03-04
15
Medium Priority
?
510 Views
Last Modified: 2007-12-19
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
Comment
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
  • Learn & ask questions
  • 8
  • 7
15 Comments
 
LVL 1

Expert Comment

by:herongan
ID: 8069402
weekdayname(weekday[,abbrevoate])

weekday: 1 to 7
abbrevoate: true/false

Hero
0
 

Author Comment

by:wuranma
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

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

abbreviate is optional.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

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

Expert Comment

by:herongan
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

by:herongan
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

by:wuranma
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

by:
herongan earned 100 total points
ID: 8069497
try following.....i already modified your code.
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

by:herongan
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

by:wuranma
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

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

Expert Comment

by:herongan
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
    temp2 = weekdayname(weekday(DateAdd("d", temp1, "11/03/2003")))
    'for i = 1 to strDays
    daysOfWeek(i)= temp2
    Response.Write(daysOfWeek(i))
    'next          
i=i+1
temp1=temp1+1
loop
=========================================================

Hero
0
 

Author Comment

by:wuranma
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

by:herongan
ID: 8069588
Maybe i got something wrong.

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

Author Comment

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question