How to get the correct number of days of the months in a given year

@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

1 Like

thanks @TIMAI2 .. Thats perfect point and actually i missed it. hmmm Will this work?

dragable blocks

Just quoting you :wink:

1 Like

Right, now I see it.

https://community.appinventor.mit.edu/uploads/default/original/3X/9/1/91a4d3e7b2cf3bc8fb6c270b4383680377f284a3.png

This was a big haystack to search.

2 Likes

I don't know how to do this...But it looks like a good idea :+1:. 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 :pray:

Lito

@>-->---

(Canned Reply: ABG - Download those blocks and post them here)

Please download and post each of those event block(s)/procedures here ...
P.S. These blocks can be dragged directly into your Blocks Editor workspace.

See Download Block Images for a demo.

...

P.S. These blocks can be dragged directly into your Blocks Editor workspace.

Dragging blocks

...

Thank you ABG. :pray: I was doing this, but saving the images on my hard drive and trying to drag from Windows Explorer to the editor ... of course it wasn't working.

Later, I will post the stamped blocks.
I want to first report a bug I found at Ai2, which is driving me crazy for days.

Lito

@>-->---

download a procedure

import a dragged  procedure

1 Like

I like @TIMAI2 's solution, short and easy to understand:

2 Likes

Thank you @ABG. It became clear. :pray:

Here the Draggable Block (my first) with my solution ยป


BTW, In this suggested link, it says: "Below is a video demonstrating how can drag and drop blocks images ..." But there is no video. Just a static image.

:pray:

Lito

@>-->---

1 Like

No more simple code can be made, herethen, than this @Kevinkun :+1:t2::+1:t2::+1:t2::+1:t2:

But wrong for years before 1600.

If I remember correctly, the first leap year after the switch to the Gregorian calendar is the year 1600. According to the rules of the Gregorian calendar, a year is a leap year if it:

  • is divisible by 4,
  • but is not divisible by 100, unless it is also divisible by 400.

Apparently App Inventor did not make the change but stuck with the Julian calendar before 1600.

1 Like

1600 was a leap year. (just like 2000, and 2400)

1582 must be in the Dark Ages (more nights than days) :wink:

The calendar reform in 1582 by Pope Gregory XIII led to the introduction of the Gregorian calendar, which was intended to solve the problem of inaccurate leap years in the Julian calendar.

2 Likes

Correct. Based on this only i coded, but peoples many not go deep into 15th or 16th century in their app. But you've tested it too deep. :+1:t2::+1:t2::+1:t2:

Oh, I think I jumped to conclusions. The calculations for the years before 1600 are (probably) correct, since the Julian calendar also had leap years, but without exception every 4 years.

Our calendar and not least the changes in 1582 will not be the last word. Almost everything - including the calendar - must be put right again! We'll see...

1 Like

To sum up: The calculation of the years before 1582 (or 1600) is identical, regardless of whether you use the Julian or the Gregorian calendar. So my objections were not correct, but they may have provided some historical insight.

Pope Gregorio is moving in his grave with this topic! ^^

@>-->---