Jump to content
UBot Underground

Yesterday's Date Issue


Recommended Posts

Here you go:

set(#yesterday,$Yesterday(),"Global")
define $Yesterday {
    comment("Convert to Unix time so we can easily subtract a day (in seconds).")
    set(#unixTimeConversion,$plugin function("DateTime Manipulation.dll", "$datetime manipulation", $date, "UBOT", "UNIX", "en-US", "en-US"),"Local")
    comment("Subtract 86,400 seconds (one day) then return in desiered format")
    return($plugin function("DateTime Manipulation.dll", "$datetime manipulation", $subtract(#unixTimeConversion,86400), "UNIX", "yyyy-MM-dd", "en-US", "en-US"))
}

You will need this: http://network.ubotstudio.com/forum/index.php/topic/13665-free-plugin-datetime-manipulation/

 

It works by first converting today's date into a Unix timestamp. We do this so that we can subtract a day by subtracting the number of seconds in a day rather than trying to guess what day/month/year etc is that would be a nightmare to account for all of that. Then convert the Unix time of exactly 24 hours ago into the format that you want and return that.

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...