SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Insert a future Date

    Hi,

    I need to enter a future date (say, one month from today's date) in the format MM/DD/YYYY. I am new to WinRunner and am unable to find any appropriate Date functions. I am using WinRunner 9.2 Can anyone please help me?

    Thank you.

  2. #2
    SQA Knight
    Join Date
    Jun 2002
    Location
    Cupertino, CA, USA
    Posts
    2,164
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Insert a future Date

    Select tools->General Options, and check "Enable date operations". Then restart WinRunner. You can then run the following code:

    <font class="small">Code:</font><hr /><pre>
    function date()
    {
    auto array[];
    auto line, file = getvar("testname") &amp; "\\Date";
    dos_system("DATE /T &gt; \"" &amp; file &amp; "\"");
    file_open(file,FO_MODE_READ);
    file_getline(file,line);
    file_close(file);
    split(line,array," ");
    return array[2];
    }


    date_enable_format ("DD MM YYYY");
    date_age_string(date(),0,1,0,new_date);
    pause(new_date);</pre><hr />

  3. #3
    Moderator
    Join Date
    Mar 2002
    Location
    Tampa Bay
    Posts
    7,673
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Insert a future Date

    Brett, your date() function seems a bit overkill to replace get_time() and time_str(), which are aleady in WR.

  4. #4
    SQA Knight
    Join Date
    Jun 2002
    Location
    Cupertino, CA, USA
    Posts
    2,164
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Insert a future Date

    [ QUOTE ]
    Brett, your date() function seems a bit overkill to replace get_time() and time_str(), which are aleady in WR.

    [/ QUOTE ]

    Peter:

    Thank you for your feedback. time_str will give you the following format:

    Tue Aug 14 13:40:00 2007

    I would assert that the headache involved in converting this to mm/dd/yyyy (which is needed by date_age_string) is more than my date() function.

  5. #5
    Moderator
    Join Date
    Mar 2002
    Location
    Tampa Bay
    Posts
    7,673
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Insert a future Date

    I guess - if you have to do it from scratch and are not very proficient - but I'd hardly describe it as a headache. (I no longer have access to WR, and I hesitate to write the code "in a vacuum," or else I'd throw something up here. Offhand, I believe it would take 1 or 2 executable statements to do the conversion).

  6. #6
    SQA Knight
    Join Date
    Jun 2002
    Location
    Cupertino, CA, USA
    Posts
    2,164
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Insert a future Date

    If you can't write the code, don't talk the talk.

  7. #7
    Moderator
    Join Date
    Mar 2002
    Location
    Tampa Bay
    Posts
    7,673
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Insert a future Date

    Thanks for that vote of confidence.

  8. #8
    Junior Member
    Join Date
    Aug 2007
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Insert a future Date

    Thank you very much. That worked for me.

 

 

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 11.54%
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 01:11 PM.

Copyright BetaSoft Inc.