?
Solved

Invalid procedure call or argument: 'weekdayname'

Posted on 2003-03-04
15
Medium Priority
?
526 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
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline

578 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