SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Oct 2005
    Location
    USA
    Posts
    86
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    comparing date values

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">

    Hi,

    I have to compare different date fields to today's date and make decision based on it. I have four date fields
    1. StartDate
    2. EndDaTe
    3. EarliestStartDate
    4. LatestFinishDate
    5. Today=Date

    StartDate and EndDate fields are populated thru back end and read only but can get value thru GetRoProperty(&quot;text&quot. EarliestStartDate and LatestFinishDate are populated based on today's date and StartDate and EndDate.

    Condition is IF &quot;Today&quot; falls in between StartDate and EndDate then EarliestStartDate and LatestFinishDate are defaulted to today's date. If &quot;Today&quot; is less than StartDate and Greater Than EndDate then EarliestStartDate=StartDate and LatestFinishDate=EndDate.

    I captured the four dates using GetROProperty(&quot;text&quot and wrote script something like below.
    StartDate=object.GetROProperty(&quot;text&quot
    EndDate=Object1.GetRoProperty(&quot;text&quot
    EarliestStartDate=Object3.GetRoProperty(&quot;text &quot
    LatestFinishDate=Object3.GetRoProperty(&quot;text& quot
    (here object, object1.. are diferent objects like
    browser(abc).page(def)....

    If (Today&gt;StartDate and Today&lt;EndDate)and (EarliestStartDate=Today)and (LatestFinishDate=Today) then
    reporter.reportEvent 0,&quot;Pass&quot;,&quot;&quot;

    ElseIf (Today&lt;StartDate and Today&gt;EndDate) and (EarliestStartDate=StartDate and LatestFinishDate=EndDate) then
    reporter.reportEvent 0,&quot;Pass&quot;,&quot;&quot;

    End If

    Need some guidance on it. Do I have to convert those date string to cDate before making comparison. And can I use &quot;and&quot; the way I have used in above script?

    Thanx a lot. </pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">
    Thank you. Keep posting.

  2. #2
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: comparing date values

    It would be better if you use DateDiff("d",date1,date2) for comparison. That would make things easier and robust

  3. #3
    Member
    Join Date
    Oct 2005
    Location
    USA
    Posts
    86
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: comparing date values

    Hi Tarun,
    Thank you for your reply. But in my condition I have to compare five date values as I have mentioned in the posting. How can I incorporate those five dates according to my testing condition? Can I use DateDiff("d"date1,date2,date3,date4) like this?

    awaiting your expert view on this

    thank you
    Sabina
    Thank you. Keep posting.

  4. #4
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: comparing date values

    No. You have to use DateDiff several times to test your condition.

  5. #5
    Member
    Join Date
    Oct 2005
    Location
    USA
    Posts
    86
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: comparing date values

    Thanx tarun.
    Thank you. Keep posting.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 12.50%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:31 AM.

Copyright BetaSoft Inc.