date comparison

Results 1 to 5 of 5

Thread: date comparison

  1. #1
    hopie Guest

    Default date comparison

    Hi...<BR><BR>I&#039m retrieving dates from a csv file, (userswinstalldate)to compare later...<BR>&#039truedate&#039 is the date i get from the user.<BR>I want to compare the dates in the file with the date from user, and then display the reports for which userswinstalldate is greater or equal to the date from user(truedate).<BR><BR>I get the error when I use datevalue function, and if I don&#039t use, I don&#039t get the correct results...since they are comparing strings and not dates ...<BR>can anyone tell me what&#039s the error here with datevalue?<BR><BR>Do While NOT objText.AtEndOfStream<BR>strline = objText.ReadLine<BR>splitter = split(strline,";")<BR><BR>UserSwInstallDate_time = split(splitter(8)," ")<BR>UserSwInstallDate = UserSwInstallDate_time(0)<BR><BR><BR>if (DateValue(UserSwInstallDate) &#062;= Datevalue(truedate) )<BR><BR>.......<BR><BR>dateValue(truedate) gives no error, <BR>but datevalue(userswinstalldate) gives:<BR><BR>Microsoft VBScript runtime error &#039 800a000d&#039 <BR>Type mismatch: &#039DateValue&#039 <BR><BR>is there any other way to compare dates coz I can&#039t get it with datevalue.....pls help...<BR>thanks....<BR><BR><BR>

  2. #2
    p_balaji@hotmail.com Guest

    Default RE: date comparison

    Hi,<BR> First of all r u sure that only date part is coming into UserSwInstallDate after the split function.<BR>any way u can try like this....<BR> if IsDate(UserSwInstallDate)=true then<BR> UserSwInstallDate=CDate(UserSwInstallDate)<BR> end if<BR> if UserSwInstallDate &#062;= Date() then<BR> .........<BR> end if<BR>Let me know if it works.....<BR>

  3. #3
    hopie Guest

    Default RE: date comparison

    sure, I&#039ve checked already...after the split, I do get the date part only....<BR>but datevalue still returns me an error....

  4. #4
    hopie Guest

    Default RE: date comparison

    I realise that the date I&#039m retrieving from my file is not a valid date when I use the IsDate function...It appears to be in the format of a date like 31/8/99 but it actually is not when i test it in the script...<BR><BR>My question is now how to make it into a valid date?????????<BR>seems impossible??? is there a way?? coz I must read from the file and I do get the date...except that it doesn&#039t seem to be valid for other functions like dateValue or Datediff to be performed!<BR><BR>Help pls...thanks a lot...


  5. #5
    p_balaji@hotmail.com Guest

    Default RE: date comparison

    Hi,<BR> the date should be like 8/31/99 to be converted into date type by any of the date functions.So parse the string date to get the day,month,year individually and reform the string in mm/dd/yy format and then try the same.u should be able to get that.Let me know what happened.<BR><BR>Balaji

Posting Permissions

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