Ok, you create these dates, but there is no duration calculation.
By using the "day of the year" number, provided within the instant, you overcome any issues with DST (which is a PITA )
Since these values simply return: 1, 2, 3, ... 364, 365.
Another "method"
(draggable blocks, but you will need a clock component)
(the value 337 is the sum of all days in months except February)
Given that "we know" the number of days for each month apart from February, we could just get February:
@TIMAI2 I am showing to you a compact formula that works for any year, which has no Dragable Blocks
to work, which does not need to be modified, which still includes all the years in which February has 29 days within a huge spectrum, that works in all circumstances. But you are showing me another method that does not meet all these requirements... I do not understand... really...
I see no reason or advantage to stop using the formula I shared. ¯\﹏(ツ)﹏/¯
Lito
@>-->---
Which requirements does my method not meet? The only month that changes its number of days is February, so the procedure simply calculates that, based upon the year.
The draggable blocks are there so others can drag them into their projects, this is a community thing, nothing to do with the content.
As I said, what I offered is simply "another method", doesn't stop anyone using yours.
I also note, having tested your method, that it does not report the days in months correctly for 1700, 1800, 1900, 2100, 2200, 2300, none of which were leap years. (ref)
Maybe I need an award ?
@TIMAI2 Yes, you need. One day I will create an 'anti-Award' for you... ^^
Thanks for the tips to improve my formula. Now it works well for every year, don't need Clock
and the Procedure
returns the value to a specific year/month, without reading anything from a List
. The reason for reviving a 2020 topic is that I fell into it in a search and just wanted to share this solution, thinking it could be useful to someone.
My_Get_Days_of_Months.aia (3.7 KB)
My_Get_Days_of_Specific_Month.aia (3.6 KB)
Lito
@>-->---
Why not make a (draggable) procedure for your blocks in your first aia (and second aia), and post them here for each of use? Saves others having to download the aias and recreating blocks.
Why such a complex blocks or work around?
Whatever the year feb month alone days will change according to its leap. Ao prepare list of month days with 28 for feb. And if the year is leap change the feb month days alone to 29, thats all.
Initialise global variable to list from csv row text to 31,28,31,30,31,30,31,31,30,31,30,31
Check the input year as leap or not.
If yes change the index 2 with 29 else let it be as it is
I read through this thread and no one tried this idea
Return the number of days between the first day of next month and the first day of this month.
(Use Clock blocks)
@Spicy_Topics
You need to take account of the 400 year cycle, your calculation will not work for years divisible by 4 that are not leap years, e.g. 1700,1800,1900,2100,2200,2300
thanks @TIMAI2 .. Thats perfect point and actually i missed it. hmmm Will this work?
dragable blocks
Just quoting you
Right, now I see it.
This was a big haystack to search.
I don't know how to do this...But it looks like a good idea . I saved several topics that deal with it, but I didn't have time to study them. Do you want to teach me or show me the documentation that explains how to create
dragable blocks
in a very direct way? @TIMAI2
Lito
@>-->---