SPONSORS:






User Tag List

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

    Changing date format to MM/DD/YYYY in QTP

    Hi All,

    The question may sound pretty naive, but I have just strated using QTP. Can any one suggest how to change the date format to MM/DD/YYYY or how to get the date in the above format?

    Regards
    Romil

  2. #2
    Member
    Join Date
    Oct 2002
    Location
    Trichy, Tamil Nadu, India
    Posts
    60
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Changing date format to MM/DD/YYYY in QTP

    FormatDateTime(Date, 0)
    Display a date and/or time. If there is a date part, display it as a short date. If there is a time part, display it as a long time. If present, both parts are displayed.

    FormatDateTime(Date, 2)
    Display a date using the short date format specified in your computer's regional settings.
    Hari,
    Consultant-QA,
    GFT Technologies,
    India.

  3. #3
    Junior Member
    Join Date
    Sep 2005
    Location
    Singapore
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Changing date format to MM/DD/YYYY in QTP

    Thanks for your time. I tried using this but the function returns the date in DD/MM/YYYY format and not MM/DD/YYYY.

  4. #4
    Senior Member
    Join Date
    Feb 2005
    Location
    Northern Ireland
    Posts
    529
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Changing date format to MM/DD/YYYY in QTP

    Try this basic function (Modify as you need)

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Function ConvertDate(inDate)
    'Split the date into an array
    temp = split(inDate, &quot;/&quot;, -1)
    'rebuild the date swapping DD and MM and set as function return value
    ConvertDate = temp(1) &amp; &quot;/&quot; &amp; temp(0) &amp; &quot;/&quot; &amp; temp(2)
    end function</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Example usage -
    mydate = ConvertDate("01/02/2005")
    msgbox mydate
    I'm not a complete idiot - some parts are missing.

  5. #5
    Advanced Member
    Join Date
    Jan 2004
    Location
    UK
    Posts
    817
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Changing date format to MM/DD/YYYY in QTP

    you could also try using CASE statements in a function. Also you might want to try and change the country format in your code from US to UK which is basically what you are asking?

    Failing that you can always use:
    endDate = dd & "/" & mth & "/" & yyyy

    at the end of your date function code

    Hope this helps [img]images/icons/smile.gif[/img]

    [ 12-02-2005, 03:05 AM: Message edited by: maxj ]
    I like what i know and I know what i like

 

 

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 10.00%
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 03:27 AM.

Copyright BetaSoft Inc.