Happy Programmer's Day!

image

Yesterday, September 12, I received 20 congratulations on Programmer's Day. Programmer's Day is the 256th day of the year. The idea of ​​celebrating this day is understandable, interesting, and is perceived favorably by both programmers and other people.

However, when I first heard about this date a few years ago, I habitually did a fact-check to figure out the exact date of the programmer's day. Imagine my surprise when my calculations did not match the date that is broadcast in the media year after year.

A simple command adds 256 days to the beginning of the year.

date -I -d '2024-01-01 + 256 days'
What does she return?

2024-09-13

September 13th. Why the hell is everyone congratulating me on the 12th?

Maybe the date utility is buggy? Let's try to calculate in Java.

import java.time.LocalDate;

public class DeveloperDay {
    public static void main(String[] args) {
        System.out.println(LocalDate.now().withDayOfYear(1).plusDays(0x100));
    }
}
Result

2024-09-13

Thirteenth again. What's going on?

I think this is how it is.

Some journalists counted with their fingers on the calendar to two hundred and fifty-six and launched articles with congratulations a day earlier. Programmers, of course, do not read such articles, but they learned from relatives, friends and acquaintances that today is their holiday. No one thought to double-check the information, so the news stuck, and the media put its publication in CRON. And now every year we celebrate Programmer's Day not on September 13/14, but on 12/13 (in a leap year, the date is reduced by 1 day).

Why did it happen this way? The thing is that when the rules of chronology were being drawn up, they didn’t know how
use zero. Everyone counted on their fingers, but you can't show zero on them. That's why we got a count based on a set of natural numbers from 1 to 366.

365 1 2 3 4 5 ... 363 364 365 1 2 3 4 5 ... 363 364 365 366 1 2 3 4 5 ...

In this set, the day preceding day number 1 has number 365 (or 366).

But in such a set, with such definitions of addition and subtraction operations, the number 256 is not round. There is no generally accepted format of representation for such a number, in which the number 256 would look somehow especially beautiful in comparison with others. Accordingly, from the point of view of programming, there is nothing remarkable in such a number.

And only the knowledge of the special role of zero distinguishes programmers from ordinary people. Only they know that before the element with the number 1 there is an element with the number 0, and the number 256 is a round number, because in binary representation it is equal to 0b100000000, and in hexadecimal – 0x100.

It is precisely the arrival of a day with a round number that is a real holiday. On the day with the number 0xFF, programmers Traditionally they go to the bathhouseand exactly at midnight, when moving from 0xFF to 0x100 at 00:00:00 UTC, they open champagne and receive congratulations the entire next day. On day number 0xFF, programmers can and should also be congratulated, but… with coming.

Congratulations, programmers!

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *