118: Data Types: DateTimes Part 1.

Take Up Code - Un pódcast de Take Up Code: build your own computer games, apps, and robotics with podcasts and live classes

Categorías:

Dates and times are a lot more complicated than we normally realize. Having a specific data type to manage all the details is crucial. 02-04-10. What does that mean? If you’re from the US, then it probably means February 4th, 2010. But it might also mean the 2nd of April, 2010. Or is it April 10th, 1902? There’s a group called the International Organization for Standardization and has been operating in its current form since 1947. Most people refer to the group as ISO and refer to various standards that the group produces as ISO followed by some number. The standard for dates has gone through several versions and is now known as the ISO 8601 standard. The current version is ISO 8601:2004 Listen to the full episode about dates and times, or you can also read further for the full transcript below. Transcript 02-04-10. What does that mean? If you’re from the US, then it probably means February 4th, 2010. But it might also mean the 2nd of April, 2010. Or is it April 10th, 1902? Not only are there different ways to display a date, there’s different ways to store and represent a date. Many of them are based on a time as well as a date. I’ll explain times in the next episode which should put everything together into the DateTime type. This episode will focus more on the details you’ll need, to understand the date portion of DateTimes. You’ll learn about standards, calendars and different ways to think about dates. We’ll get to the actual DateTime data type in the next episode. There’s a group called the International Organization for Standardization or as it’s normally known, I, S, O, or ISO and has been operating in its current form since 1947. If you’re wondering why the order of the letters doesn’t match the name, that’s something I’d like to know too. I always thought it was because the original name was in a different language that did match the letters. But that doesn’t seem correct. Whatever the name, most people refer to the group as ISO and refer to various standards that the group produces as ISO followed by some number. The standard for dates has gone through several versions and is now known as the ISO 8601 standard. It can sometimes be difficult to read a standard document because the language has to be very specific. Documents like this sometimes leave out aspects that I consider important and then define something else in such detail that I find it difficult to stay awake. If you’re the same way, then let me help by lending my interpretation of this standard. When we write a time, we’re already used to the hour coming before the minute which comes before the second. This is beneficial in many ways including that it helps sort things. The standard defines a similar ordering for dates that also starts with the biggest unit, then the next smaller unit, all the way to the smallest unit. For dates, this means that the year comes first, then the month, and then the day. Why do we need months though? I mean, they’re sort of arbitrary. Maybe at some point in history, they referred to the cycles of the moon but now we learn about the months, their order, and the number of days in each through a children’s rhyme. Or you can use my favorite, the knuckle test. Why does August get 31 days? Why not take a day from a couple of the longer months and give them to February. It always seemed a bit unfair to me that February was so short. We normally use the Gregorian calendar which defines months more out of tradition than anything else. And it’s based on a Christian event that defines the beginning of the calendar. This is not the only calendar system in the world. There are other systems that are used extensively and in everyday matters. Some of them are based on the cycles of the moon which at least makes the concept of a month important and relevant. Because we have different calendars each with different starting

Visit the podcast's native language site