SPONSORS:






User Tag List

Results 1 to 7 of 7
  1. #1
    Guest

    Re: Verify DateFormat(MM/DD/YYYY)

    Thanks Mr Godknows...
    but Iam unable to understand your code..see your logic below.

    sText = "mm/dd/yy"
    size = len(sText) // Size = 8
    if((size - 7)==2) // if((8-7)==2) false
    Print("mm/dd/yy") // goes to else
    if((size-7)==4) // if((8-7)==4) false
    print("mm/dd/yy") // goes to else since the condition failed here too.

    Can you please explain me how the above logic works for "mm/dd/yyyy".

    ------------------
    Satya

    [This message has been edited by victosatya (edited 03-07-2001).]

  2. #2
    Guest

    Re: Verify DateFormat(MM/DD/YYYY)

    You could do the following

    sDate = mm/dd/yy

    if Len(GetField(sDate,"/",3)) == 2
    // format is mm/dd/yy
    else
    // format is mm/dd/yyyy


    [This message has been edited by John Burross (edited 03-07-2001).]

  3. #3
    Guest

    Verify DateFormat(MM/DD/YYYY)

    Hi,

    I hope someone would help me.

    I have an expected value in the format MM/DD/YYYY, by using Silk how can I verify this format whether it is in MM/DD/YY or MM/DD/YYYY. Is there any builtin format function available in Silk?

    Many thanks in advance for your cooperation.



    ------------------
    Satya

  4. #4
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Verify DateFormat(MM/DD/YYYY)

    Use:

  5. #5
    Junior Member
    Join Date
    Oct 2000
    Location
    Arlington Heights, IL, US
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Verify DateFormat(MM/DD/YYYY)

    Hi Satya
    A slight modification to GodKnows code for DateFormat.
    Use code like this

    [ ] STRING sText = "mm/dd/yyyy"
    [ ] INTEGER Size= len(sText)
    [-] if((Size-6)==2)
    [ ] print("mm/dd/yy")
    [-] else
    [ ] print("mm/dd/yyyy")
    Thanks
    Prasad,Kilaru

  6. #6
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Verify DateFormat(MM/DD/YYYY)

    Basically:

    1)get the length of your time string
    2)get the length of your string until the character before the year character (yy or yyyy)
    3)get the difference between 1) and 2)
    4)then check if the string is mm/dd/yy or mm/dd/yyyy


    To kilarup: You cannot use 'else' because you assume that anything else is mm/dd/yyyy.
    Although my reasoning is similarly flawed
    it should work.
    Hope this helps.

    [This message has been edited by GodKnows (edited 03-08-2001).]

  7. #7
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Verify DateFormat(MM/DD/YYYY)

    Try the SilkTest built in function ParseDateFormat

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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 11:09 PM.

Copyright BetaSoft Inc.