SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Jun 2006
    Posts
    34
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Changing the system date in QTP

    I need to change the system date to the first of the month. Here is the code I am using unsucessfully:

    -----------------------------

    Dim MyDate, NewDate

    MyDate = date

    NewDate = Replace(MyDate,"DD","1")

    Msgbox NewDate

    ----------------------------

    Can someone tell me what I am doing wrong here??

    Thanks!!
    FIRSTcomeFIRSTserved

  2. #2
    Member
    Join Date
    Jun 2006
    Posts
    34
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Changing the system date in QTP

    Never mind, I figured it out. I just needed to tweak some old "date" code I had lying around. This works:

    -----------------------------------

    Dim MyDate, NewDate, dd, mm, y4, yy

    MyDate = date

    dd = DatePart("D", Now)
    mm = DatePart("M", Now)
    y4 = DatePart("YYYY", Now)
    yy = Right(y4,4)
    If dd>1 Then dd = 1 End If
    NewDate = mm & "/" & dd & "/" & yy

    Msgbox NewDate

    -------------------------

    Hope someone can use this ;0)

    FIRSTcomeFIRSTserved

 

 

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 02:15 AM.

Copyright BetaSoft Inc.