Jump to content
UBot Underground

How do I find out all dates between two dates


Recommended Posts

Hello,

 

I want to build a very simple program that the user can choose how many weeks out it wants to project and then my program fills in those dates in a column on a table.

 

So for example:

 

How many weeks do you want

1,2,3,4,5,6,7,8,9,10

 

User answers:

 

Dates get filled in a column

 

4/23/2014

4/24/2104

4/25/2014

4/26/2014

4/27/2014

etc....

 

Table gets converted to html and displayed in the browser

 

The part that is tripping me up is figuring out how to do the logic around the dates. Is there an easy way to tell that April has 30 days and May has 31 and so on?

 

I have aymen's plugin that gives me the advanced date functions and I also have the $datetimemanipulation plugin but can't quite seem to figure this one out easily.

 

Thanks

Link to post
Share on other sites

Thanks Zap and Martin C for the response but I am looking at getting all the dates listed so it would be as follows:

ui drop down("Number of Days", "7,14,21,28,35,42", #NumDays)
set(#Pos, 0, "Global")
set(#Date, $plugin function("DateTime Manipulation.dll", "$datetime manipulation", $date, "UBOT", "Short date", "en-US", "en-US"), "Global")
loop(#NumDays) {
    set table cell(&Results, #Pos, 0, #Date)
    set(#Date, $Get Next Day($table cell(&Results, #Pos, 0)), "Global")
    increment(#Pos)
}
set(#Table, $plugin function("SQLlite.dll", "$table to html", &Results, "Yes"), "Global")
load html(#Table)

The problem is the $Get Next Day doesn't accept any parameters. It just gets the next day that you are currently living in.  so those parameters I gave it don't work and I know that, I just wanted to illustrate one solution I thought of if Aymen's $Get Next Day function accepted parameters.

Link to post
Share on other sites

It's a bit more complicated then that....

 

 

here play with this

 

ui text box("How many days?"#how many days)
set(#start date$plugin function("DateTime Manipulation.dll""$datetime manipulation"$date"UBOT""UNIX""en-US""en-US"), "Global")
set(#day inc, 1, "Global")
loop(#how many days) {
    set(#day in seconds$multiply(86400, #day inc), "Global")
    set(#add day in seconds$add(#start date#day in seconds), "Global")
    set(#new date$plugin function("DateTime Manipulation.dll""$datetime manipulation"#add day in seconds"UNIX""MM/dd/yyyy""en-US""en-US"), "Global")
    wait(2)
    increment(#day inc)
}
ui stat monitor(""#new date)

 

TC

  • Like 1
Link to post
Share on other sites

It's a bit more complicated then that....

 

 

here play with this

 

ui text box("How many days?"#how many days)

set(#start date$plugin function("DateTime Manipulation.dll""$datetime manipulation"$date"UBOT""UNIX""en-US""en-US"), "Global")

set(#day inc, 1, "Global")

loop(#how many days) {

    set(#day in seconds$multiply(86400, #day inc), "Global")

    set(#add day in seconds$add(#start date#day in seconds), "Global")

    set(#new date$plugin function("DateTime Manipulation.dll""$datetime manipulation"#add day in seconds"UNIX""MM/dd/yyyy""en-US""en-US"), "Global")

    wait(2)

    increment(#day inc)

}

ui stat monitor(""#new date)

 

TC

Thank you so much

Link to post
Share on other sites
  • 2 weeks later...

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