date calculation

Results 1 to 3 of 3

Thread: date calculation

  1. #1
    Join Date
    Dec 1969

    Default date calculation

    I am trying to calculate new date based on users input. <BR>user entered lock effective date and lock term (which is 7,15,30,...days). I calculate lock expiration date which is lock effective date + lock term days. I am updating table with this new date. also wrote a function so lock expiration date is always false on next business day.<BR><BR> Function LockExpirDate(sdate1)<BR> if weekday(sdate1) = 1 then<BR> sdate2 = dateadd("d",1,sdate1)<BR> elseif weekday(sdate1) = 7 then<BR> sdate2 = dateadd("d",2,sdate1)<BR> else<BR> &#039nothing<BR> end if <BR> End Function<BR><BR>mlockeff = request("txt_lock_eff")<BR>MyStr = FormatDatetime(mlockeff,vbshortdate)<BR>slockeff = "to_date(&#039" & Mystr & "&#039, &#039mm/dd/yyyy&#039)"<BR><BR>slockterm = request("txt_lock_term")<BR><BR>sdate1 = dateadd("d",slockterm,mlockeff)<BR>mlockexpir = LockExpirDate(sdate1)<BR>MyStr1 = FormatDateTime(mlockexpir,vbshortdate)<BR>slockexp ir ="to_date(&#039" & Mystr1 & "&#039, &#039mm/dd/yyyy&#039)"<BR><BR>but keep getting error on mlockeff.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: date calculation

    WHAT error do you get? On WHAT line?<BR><BR>

  3. #3
    iyyappan n iyer Guest

    Default RE: date calculation

    there are lots of wonderful date functions in vbscript.<BR><BR>one of the most interesting is DateSerial(), it silve your problem.

Posting Permissions

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