Working with Dates

Working with Dates

Lesson Details:
July 10, 2020

I: Introduction

Before the introduction, the reader should be familiar with what a programming language is. It can be a natural language but it’s not. It’s a set of rules to communicate. If a programmer wants to communicate a program or idea, then he must use a coding language.

Programming languages are everywhere. They are even in our smartphones and computers. The first computer was built in 1946 by a British mathematician named Alan Turing. It weighed about 10 tons, and it had no programming language. The code was written in binary code, and it could only store 0s and 1s. In the 1950s, programming languages were introduced to make the language more flexible and easy to use. Like all other languages, it requires the usage of syntax and grammar to define and control the structure. The syntax and grammar of a language is called its grammar.

There are lots of programming languages today. We have C++ and Java, which are used to create apps for smartphones and computers. And we have Python, which is used to create games and websites online. There are also languages like C# and JavaScript, which run on the web through browsers like Google Chrome and Mozilla Firefox. There are also languages like JavaScript and Python that can run on both the internet and phones.

II: Body

A: Working with dates

Do you know when your birthday is? You may think that it’s the best day of the year for you, but you might be wrong! It may be celebrated your birthday on March 15, but in some parts of the world, it might be celebrated on March 16. And in some parts of the world, it might not even be celebrated at all! The reason for this is because there are two different calendars running side-by-side. One is called the Gregorian calendar, another is called the Lunisolar calendar. Both have their own pros and cons. The Gregorian calendar has 12 months, each month has 30 days, with an extra 5 days added to certain months to adjust for leap years. Birthdays are always on December 31st because it is always the last day of the year. The problem with this calendar is that it is not very accurate! There are too many Leap Years compared to regular years, so the calendar cannot keep track of time very well over longer periods of time. Year 2000 was not a leap year but 2100 will be! This would make it impossible to know exactly when your birthday is after 100 years! For example, if today is January 1st, 2017, then my birthday must be around October 31st or November 1st, 2016! But I know that my birthday is on September 14th! How come I know that my birthday is on September 14th? Because I’ve been using another calendar system called the Lunisolar calendar! The Lunisolar calendar is similar to the Gregorian calendar except that it has 8 cycles of 28 days instead of 12 cycles of 30 days. This means that there are sometimes 30 or 29 days per month instead of 31 days per month! However, it does not have any Leap Years! So after every 100 years, our birthdays would return back to where they started! For example, if my birthday is on September 14th now, after 100 years later (2100), my birthday would be back on September 14th again! On top of that, this calendar system uses 28 days every 4 years instead of every 100 years! This means that after 400 years (2400), my birthdays would be back to where they started again!

Course content