Thanks! This is Yosuke. Since one screen of the diary app is finally over, I was on a day trip mini trip for about 10 hours. I was enthusiastic that I would take a lot of pictures with a single-lens reflex camera, but I could hardly take pictures ... I was just tired and it was a lot of days, such as being run over by a careless car in front and behind on my way home ( Lol). This time, if the day incorporated in the diary application is a national holiday, display it and tap it to display the details in a dialog. I will introduce that in the first part and the second part.
--National holidays --Holidays with fixed dates --Holiday on the 0th Monday --Spring and autumn equinox --Transfer holiday
First, let's write down the national holidays in Japan. ** New Year's Day, Adult Day, National Foundation Day, Emperor's Birthday, Spring Day, Showa Day, Constitution Day, Greenery Day, Children's Day, Marine Day, Mountain Day, Keiro Day, Autumnal Equinox Day There are 16 days, Sports Day, Culture Day, and Labor Thanksgiving Day **. "Health Sports Day" was changed to "Sports Day" in 2020. Next, we will talk about dates that will be important in the program.
This is a list of holidays that have a programmatically easy date set from the beginning.
Holiday name | date | Remarks |
---|---|---|
New Year's Day | January 1 | - |
Foundation Day | February 11 | - |
The emperor's birthday | February 23 | - |
Showa Day | April 29 | - |
Constitution Memorial Day | May 3 | - |
Greenery day | May 4th | - |
Children's day | May 5th | - |
Mountain day | August 11 | August 10, 2020 |
Culture Day | November 3rd | - |
Labor Thanksgiving Day | November 23 | - |
Holiday name | date | Remarks |
---|---|---|
Coming of age day | 2nd Monday of January | - |
Marine day | 3rd Monday of July | July 23, 2020 |
Respect for the aged day | 3rd Monday of September | - |
Sports day | 2nd monday in october | July 24, 2020 |
As shown in the table above, holidays will move in 2020, when the Olympics and Paralympics are held, but it seems that we can somehow determine it because we know the month, week, and day of the week.
These two holidays were a nuisance. First, the spring equinox day is one of the 19th to 22nd of March, and the autumnal equinox day is one of the 22nd to 24th of September. The reason why the days differ depending on the year seems to be related to the orbital period of the earth, so please see here for details. ). Do I have to enter the spring and autumn equinox days while looking at the calendar one by one? At first, I dropped my shoulders, but according to Wikipedia, the days of the spring and autumn equinoxes of that year can be decided by dividing the year by four. Vernal Equinox Day: https://en.wikipedia.org/wiki/%E6%98%A5%E5%88%86%E3%81%AE%E6%97%A5 Autumnal Equinox Day: https://en.wikipedia.org/wiki/%E7%A7%8B%E5%88%86%E3%81%AE%E6%97%A5
Substitute holidays are a bit confusing as "the day after a national holiday that is not a national holiday after the Monday following the national holiday Sunday," but the holiday law states that. Simply put, if Sunday is a holiday, it may be better to think that the next weekday will be used for the transfer holiday.
In the second part, it is hard to say that it is an explanation with the idea and the source code actually written, but I think I will explain it. I will raise it within this week, so thank you.
Holiday Law: https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html National Holidays: https://en.wikipedia.org/wiki/%E5%9B%BD%E6%B0%91%E3%81%AE%E7%A5%9D%E6%97%A5
Recommended Posts