jssrecording 3 Posted January 26, 2017 Report Share Posted January 26, 2017 I'm trying to get yesterdays date in year month day format 2017-01-25. How would you use the $date for this tackle? Any help would be great! Jason 1 Quote Link to post Share on other sites
HelloInsomnia 1103 Posted January 26, 2017 Report Share Posted January 26, 2017 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. 1 Quote Link to post Share on other sites
jssrecording 3 Posted January 26, 2017 Author Report Share Posted January 26, 2017 HelloInsomnia Looks awesome! One problem the link to the download is scrambled up with shortcode stuff.Do you have this? Quote Link to post Share on other sites
HelloInsomnia 1103 Posted January 26, 2017 Report Share Posted January 26, 2017 HelloInsomnia Looks awesome! One problem the link to the download is scrambled up with shortcode stuff.Do you have this? You can get all his plugins free here: http://ubotdev.com/free-ubot-plugins Quote Link to post Share on other sites
jssrecording 3 Posted January 26, 2017 Author Report Share Posted January 26, 2017 Okay got it installed! Thanks Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted January 27, 2017 Report Share Posted January 27, 2017 Here is a plugin free solution with Python. alert($python result("yesterday","import datetime datetime.date.fromordinal(datetime.date.today().toordinal()-1)")) Regards,Nick 2 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.