datediff problem part 2

Results 1 to 3 of 3

Thread: datediff problem part 2

  1. #1
    alexbeginner Guest

    Default datediff problem part 2

    I have another problem here is the code!<BR>Why will it not work and what do i need to learn to understand why it is not happening!<BR><BR>&#060;script language="VBscript"&#062;<BR>Dim Cast<BR>Cast=#28/12/82#<BR>Function DiffADate(Today)<BR> DiffADate="Days from Today: " & DateDiff("d", Cast,Date())<BR>End Function<BR>&#060;/script&#062;<BR><BR>Cheers <BR>Alex<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: datediff problem part 2

    in your function you need to refer to the name of the variable as it is passed in, not what it was called outside your function.<BR><BR>&#060;script language="VBscript"&#062;<BR>Dim Cast<BR>Cast=#28/12/82#<BR>Function DiffADate(dtTest)<BR>DiffADate="Days from Today: " & DateDiff("d", dtTest,Date())<BR>End Function<BR>&#060;/script&#062;<BR><BR><BR>then pass in Cast to your function<BR><BR>dim foo<BR>foo = DiffADate(Cast)<BR><BR>

  3. #3
    alexbeginner Guest

    Default RE: passing ?

    Could you explain what you mean by pass to the function.<BR>Thank you for helping!<BR>Alex

Posting Permissions

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