SPONSORS:






User Tag List

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

    Re: Manipulation of Dates

    Funny question because the anwser is in your question. Everything is returned as STRING, so you can do change it to the date you want.

    Check silk's help for more example from help:

    DATETIME DayAndTime
    STRING sTime
    STRING sDate
    // get current date and time
    DayAndTime = GetDateTime ()
    // format current date and time
    sTime = FormatDateTime (DayAndTime, "hh:nn:ss AM/PM")
    sDate = FormatDateTime (DayAndTime, "mm/dd/yy")
    Print ("Script started at {sTime} on {sDate}.")

    use Val() to convert from string to integer
    and Val(Str(1))=1

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

  2. #2
    Junior Member
    Join Date
    Feb 2002
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Manipulation of Dates

    I am using the GetDateTime() function to get today's date, but I need to manipulate the date so that I get Yesterday's date. Is there any functions that Silk has that could get me Yesterday's date from Today's date?

  3. #3
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Manipulation of Dates

    If you use the AddDateTime function, then you can leave your DATETIME variable in DATETIME format, and just add or subtract units of time. For your purpose (subtracting one day to leave yesterday, just use the following code:
    ------------------

  4. #4
    Junior Member
    Join Date
    Mar 2001
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Manipulation of Dates

    After you subtract the one day ( -1 )
    you can modify the format with FormatDateTime. You can use as many, or as few of the Masks that you want. Sometimes it is easier to do 3 or 4 seperate FormatDateTime calls, so that you can have a seperate value for each of them ( the day Monday, the day 2 ( second day ), the month Feb, the month (2 ) etc., so that you can match up the format with what your application is doing.

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

 

 

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 12:27 AM.

Copyright BetaSoft Inc.