Date Subtraction

Results 1 to 2 of 2

Thread: Date Subtraction

  1. #1
    Join Date
    Dec 1969

    Default Date Subtraction

    Can anyone tell me how to retrieve the date value of a given number of days ago?<BR><BR>I have tried the following:<BR><BR>Dim DaysAgo As Integer = Request.Form("DaysAgo")<BR>Dim ThisDay As Date = Now<BR>Dim newDate As Date = ThisDay-DaysAgo<BR> <BR><BR>which gives the error message:<BR><BR>Operator &#039;-&#039; is not defined for types &#039;Date&#039; and &#039;Integer&#039;

  2. #2
    Join Date
    Dec 1969

    Default RE: Date Subtraction

    you can use the dateAdd function, and pass it a negative number<BR><BR>ms-help://MS.NETFrameworkSDKv1.1/vblr7net/html/vafctDateAdd.htm

Posting Permissions

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