WEBVTT
Kind: captions
Language: en

1
00:00:00.130 --> 00:00:04.050
As I publish this video, it is already the
first day of 2020.

2
00:00:04.050 --> 00:00:06.080
And it's also December 30, 2019,
they haven't actually started

3
00:00:06.080 --> 00:00:08.320
rigging the fireworks on
the London Eye yet.

4
00:00:08.320 --> 00:00:10.260
But the reason I can say that it's 2020

5
00:00:10.260 --> 00:00:12.520
is also the reason why, a few years back,

6
00:00:12.520 --> 00:00:14.260
Twitter failed for a few hours.

7
00:00:14.270 --> 00:00:16.660
See, there are a lot of calendars in the world.

8
00:00:16.660 --> 00:00:21.199
Yes, most of us have standardised on the
Gregorian calendar, January to December,

9
00:00:21.199 --> 00:00:24.300
but there are still some 
used for specific things.

10
00:00:24.300 --> 00:00:26.460
In the Islamic calendar, it's the year 1441.

11
00:00:26.460 --> 00:00:28.149
In the Hebrew calendar, 5780.

12
00:00:28.149 --> 00:00:30.179
And in the ISO Week System,

13
00:00:30.179 --> 00:00:34.310
defined by the International Standards Organisation
and used for finance and business,

14
00:00:34.310 --> 00:00:37.300
it is already 2020.

15
00:00:37.300 --> 00:00:40.220
It's handy sometimes, particularly
when you're dealing with money,

16
00:00:40.220 --> 00:00:43.710
to always have a whole number of weeks
in a year.

17
00:00:43.710 --> 00:00:47.940
And 7 days in a week just doesn't divide into
365 days in a year cleanly.

18
00:00:47.940 --> 00:00:49.860
Or 366 for a leap year.

19
00:00:49.860 --> 00:00:52.380
So back in the seventies, the ISO defined
the ISO Week System:

20
00:00:52.380 --> 00:00:54.800
where the year always starts on a Monday,

21
00:00:54.800 --> 00:00:57.950
and there are always a whole number of weeks
in the year.

22
00:00:57.950 --> 00:01:01.350
Most of a time that's 52 weeks,
so 52 times 7: 364 days,

23
00:01:01.350 --> 00:01:04.580
but occasionally there's basically a
'leap week' to catch things up.

24
00:01:04.580 --> 00:01:08.170
Most of the time, the ISO year number is the
same as the regular one we all use.

25
00:01:08.170 --> 00:01:11.719
But around New Year,
it's not always in perfect sync.

26
00:01:11.719 --> 00:01:12.719
Like right now.

27
00:01:12.719 --> 00:01:15.590
As I publish this, it is December 30th, 2019,
Gregorian Calendar.

28
00:01:15.590 --> 00:01:16.939
But in the ISO Week System,

29
00:01:16.940 --> 00:01:19.860
it is year 2020, week 1, day 1.

30
00:01:19.860 --> 00:01:22.060
It's a perfectly valid calendar,

31
00:01:22.070 --> 00:01:25.320
but it can be confusing because it's so close
to our regular Gregorian calendar.

32
00:01:25.320 --> 00:01:29.170
And it doesn't have the concept
of months. Only weeks.

33
00:01:29.170 --> 00:01:32.939
It's only meant to be used for things like
bookkeeping and paying salary.

34
00:01:32.939 --> 00:01:36.140
But back at the end of 2014,
Twitter's Android app and web site

35
00:01:36.140 --> 00:01:38.560
mysteriously failed for a few hours.

36
00:01:38.560 --> 00:01:42.770
And the reason was almost certainly someone
getting the two calendars mixed up.

37
00:01:42.770 --> 00:01:46.080
See, most high-level programming languages
have a function for getting

38
00:01:46.080 --> 00:01:50.120
the current date and time, and formatting it
in a particular human-friendly way.

39
00:01:50.120 --> 00:01:53.020
So if you want the day, month and year in
a human-friendly format,

40
00:01:53.020 --> 00:01:56.320
you create a string like that,
you run it through a standard function,

41
00:01:56.320 --> 00:01:59.159
and it swaps out the bits
that flagged by percent signs,

42
00:01:59.159 --> 00:02:01.819
and you get a sensible result out.

43
00:02:01.819 --> 00:02:05.189
But it's easy to get the letters
in that string wrong.

44
00:02:05.189 --> 00:02:09.090
%m is month as a number.
But %b is the month written out as a word.

45
00:02:09.090 --> 00:02:11.480
They're not always the letters you expect.

46
00:02:11.480 --> 00:02:14.840
Plus, most programmers
don't have to use that often,

47
00:02:14.840 --> 00:02:18.050
so we tend to refer to the help files
every time to be safe.

48
00:02:18.050 --> 00:02:22.010
And if you just search those help files from
the top down for "year",

49
00:02:22.010 --> 00:02:24.500
the first result is %g.

50
00:02:24.500 --> 00:02:26.630
So you go ahead, not knowing what
ISO week means,

51
00:02:26.630 --> 00:02:29.130
you use %g, and it looks right,

52
00:02:29.130 --> 00:02:32.040
and you don't realise until, well, today,

53
00:02:32.040 --> 00:02:34.890
that it's using a completely different calendar.

54
00:02:34.890 --> 00:02:39.190
And that's almost certainly why, for a few
hours back at the end of 2014,

55
00:02:39.190 --> 00:02:40.820
at least, our 2014,

56
00:02:40.820 --> 00:02:41.910
Twitter got the year wrong.

57
00:02:41.910 --> 00:02:45.590
They'd accidentally taken the day and month
from the Gregorian calendar,

58
00:02:45.590 --> 00:02:47.660
but the year from the ISO week system.

59
00:02:47.660 --> 00:02:50.360
It's one of those bugs that
even with a lot of testing,

60
00:02:50.360 --> 00:02:53.290
you might not actually spot
until something goes wrong.

61
00:02:53.290 --> 00:02:58.070
So if 2019 has been a rough year for you,
and you want to leave it behind:

62
00:02:58.070 --> 00:03:00.540
change calendars for a little while.

63
00:03:00.540 --> 00:03:01.840
Welcome to the twenties.

64
00:03:01.840 --> 00:03:05.050
Fasthosts are a British web host who've been
in the business for twenty years

65
00:03:05.050 --> 00:03:07.170
and host more than a million domains.

66
00:03:07.170 --> 00:03:09.250
They're offering viewers from the UK the chance
to win a trip

67
00:03:09.250 --> 00:03:14.900
to SXSW 2020 in Austin, Texas,
including flights and accomodation.

68
00:03:14.900 --> 00:03:19.030
To enter the draw, you need to answer this
techie-test question that I've written:

69
00:03:19.030 --> 00:03:21.840
this JavaScript code is meant to simulate
a coin flip,

70
00:03:21.840 --> 00:03:23.610
but it's not working properly.

71
00:03:23.610 --> 00:03:24.780
Where's the bug?

72
00:03:24.780 --> 00:03:27.920
There's one big error that means it's only
returning heads.

73
00:03:27.920 --> 00:03:28.920
If you reckon you know,

74
00:03:28.920 --> 00:03:32.600
click the link in the description and you
could be off to SXSW.

75
00:03:32.600 --> 00:03:36.020
All the terms and conditions are over on
Fasthosts' web site. Good luck!

