Jump to content
UBot Underground

Recommended Posts

Hi!

I'm trying to get ubot to type yesterdays date. Anyone know how to get this done? I know the $date function will provide today's date and time but I'm not sure how to remove the time and simply -1 the day. 

 

I would also need to do the same thing but -4 days so I can create a date range.

 

Thanks for the help!

Link to post
Share on other sites

Going forwards a day or 3 would be a bit simpler you could use the File Management Plugin which has a function for that. Unfortunately, it doens't go backwards.

 

To go backwards you could use this: http://network.ubotstudio.com/forum/index.php/topic/13665-free-plugin-datetime-manipulation/

 

Then convert the time to a unix timestamp, then subtract (86400 * x) where x is the number of days. There are 86400 seconds in a day so you multiple that by the number of days you need. You then subtract that from the unix timestamp and then convert it back to the format you want using the plugin. That will give you the time x number of days ago.

Link to post
Share on other sites

Here's a quick example of what I said above:

ui text box("Days to go back",#days_ago)
set(#unix_current_time,$plugin function("DateTime Manipulation.dll", "$datetime manipulation", $date, "UBOT", "UNIX", "en-US", "en-US"),"Global")
set(#time_to_subtract,$multiply(86400,#days_ago),"Global")
set(#unix_days_ago,$subtract(#unix_current_time,#time_to_subtract),"Global")
set(#time_days_ago,$plugin function("DateTime Manipulation.dll", "$datetime manipulation", #unix_days_ago, "UNIX", "UBOT", "en-US", "en-US"),"Global")
alert(#time_days_ago)
Link to post
Share on other sites

Thanks for this! I will test it out here shortly to see if I can get it working (i'm still pretty new at this). Just FYI: this is why i'm trying to do:
http://screencast.com/t/XN6RNG2DBEkO

If you have a better way of doing that, i'm all ears!

Thanks again, I appreciate your help!

Link to post
Share on other sites

You may just be able to input the date into the field there I would think. You can change the formatting of the output, I just did it for you and if you run this code you will see it's already in the format that is in your video:

ui text box("Days to go back",#days_ago)
set(#unix_current_time,$plugin function("DateTime Manipulation.dll", "$datetime manipulation", $date, "UBOT", "UNIX", "en-US", "en-US"),"Global")
set(#time_to_subtract,$multiply(86400,#days_ago),"Global")
set(#unix_days_ago,$subtract(#unix_current_time,#time_to_subtract),"Global")
set(#time_days_ago,$plugin function("DateTime Manipulation.dll", "$datetime manipulation", #unix_days_ago, "UNIX", "Short date", "en-US", "en-US"),"Global")
alert(#time_days_ago)
Link to post
Share on other sites

I've added "#time_days_ago" to the element I want to place the date, but nothing is coming up:

http://screencast.com/t/zvWa2HbSts

 

I also entered "Days to go back" as 1

 

Can you type yourself into that field and will it work then? Or do you have to select via the calendar. I see that's on Amazon seller central which I personally don't have access to so I can't really go look at the site myself. Maybe somebody else here is an Amazon seller though.

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...