Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,005 --> 00:00:05,007
- Dates, let's talk about dates and times.
2
00:00:05,007 --> 00:00:08,003
If you've done any programming in any language,
3
00:00:08,003 --> 00:00:11,000
and you know that handling dates and times
4
00:00:11,000 --> 00:00:16,006
can get messy quick, well not so much in HTML.
5
00:00:16,006 --> 00:00:20,007
HTML simply has one element that we use to mark anything
6
00:00:20,007 --> 00:00:25,002
that's specifying a time of day, a date, or span of time,
7
00:00:25,002 --> 00:00:27,004
the time element.
8
00:00:27,004 --> 00:00:30,009
We use the time element to format a date or time,
9
00:00:30,009 --> 00:00:34,005
anything that's related to a specific moment or range
10
00:00:34,005 --> 00:00:38,008
in time, into something other computers can understand.
11
00:00:38,008 --> 00:00:42,007
The time element has an opening and a closing tag,
12
00:00:42,007 --> 00:00:47,004
the opening time tag, May 8th the closing time tag.
13
00:00:47,004 --> 00:00:53,000
Or like this with year, May 8th 2025.
14
00:00:53,000 --> 00:00:55,004
Well or some people write dates like that,
15
00:00:55,004 --> 00:00:59,008
others write it like this 8th May 2025.
16
00:00:59,008 --> 00:01:02,008
We can use any human understandable format
17
00:01:02,008 --> 00:01:05,009
for the phrase of text that's between the tags.
18
00:01:05,009 --> 00:01:08,003
That's what will get displayed on the webpage,
19
00:01:08,003 --> 00:01:10,002
that's what other humans will see.
20
00:01:10,002 --> 00:01:12,009
But the whole point of this element is to convey
21
00:01:12,009 --> 00:01:17,007
to computers exactly when this date or time is.
22
00:01:17,007 --> 00:01:22,001
For that, we use what's called an HTML attribute.
23
00:01:22,001 --> 00:01:25,008
Now we haven't talked about HTML attributes yet,
24
00:01:25,008 --> 00:01:29,007
we can put an attribute on any HTML element.
25
00:01:29,007 --> 00:01:32,001
And I'll get into that in a later video,
26
00:01:32,001 --> 00:01:34,001
but let's just start with the attribute
27
00:01:34,001 --> 00:01:36,002
that will give us a place to put data,
28
00:01:36,002 --> 00:01:38,006
about when this date or time is.
29
00:01:38,006 --> 00:01:41,003
Data that a computer will understand.
30
00:01:41,003 --> 00:01:44,005
We've already learned that the element name goes first,
31
00:01:44,005 --> 00:01:47,002
right after the opening less than sign.
32
00:01:47,002 --> 00:01:51,003
Then let's type a space and right the attribute name,
33
00:01:51,003 --> 00:01:55,009
followed by equals and the attribute value inside quotes.
34
00:01:55,009 --> 00:01:57,003
For the time element,
35
00:01:57,003 --> 00:01:59,009
we're going to use the date time attribute data.
36
00:01:59,009 --> 00:02:07,000
Datetime all one word, datetime equals 2025 dash 05 dash 08.
37
00:02:07,000 --> 00:02:09,001
The time inside the date time attribute,
38
00:02:09,001 --> 00:02:11,005
needs to be in a specific format.
39
00:02:11,005 --> 00:02:14,004
There's a specific machine-readable format
40
00:02:14,004 --> 00:02:17,006
for dates and times, and we have to use that.
41
00:02:17,006 --> 00:02:23,000
Let's look at some more examples May 8th is conveyed 05, 08.
42
00:02:23,000 --> 00:02:26,002
With a year no matter how its phrase for humans,
43
00:02:26,002 --> 00:02:29,003
the machine-readable version in the datetime attribute
44
00:02:29,003 --> 00:02:34,000
is written, 2025 dash 05, dash 08,
45
00:02:34,000 --> 00:02:37,005
the year and four digits then the month in two digits,
46
00:02:37,005 --> 00:02:39,009
and then the date in two digits.
47
00:02:39,009 --> 00:02:41,009
Or maybe we don't have a date,
48
00:02:41,009 --> 00:02:44,006
and we just have the month and the year.
49
00:02:44,006 --> 00:02:47,003
Or maybe we just have the year.
50
00:02:47,003 --> 00:02:50,006
We don't have to write out the date on the web page.
51
00:02:50,006 --> 00:02:54,001
Lots of times sites will use time stamps
52
00:02:54,001 --> 00:02:58,008
with phrases like five hours ago or 10 days ago,
53
00:02:58,008 --> 00:03:01,000
but the attributes still uses
54
00:03:01,000 --> 00:03:03,002
a proper machine-readable version,
55
00:03:03,002 --> 00:03:05,004
anything is allowed for humans.
56
00:03:05,004 --> 00:03:08,009
The machines want a very standardized format,
57
00:03:08,009 --> 00:03:12,004
we can also mark up times with the time element.
58
00:03:12,004 --> 00:03:14,006
The machine-readable version wants numbers
59
00:03:14,006 --> 00:03:18,005
in the 24 hour clock format, we can include seconds
60
00:03:18,005 --> 00:03:20,005
and fractions of a second or not.
61
00:03:20,005 --> 00:03:25,005
We can include the time zone 15 45 minus 05 00,
62
00:03:25,005 --> 00:03:29,009
means 15 45 or 3:45pm
63
00:03:29,009 --> 00:03:33,000
in the time zone that's minus five hours
64
00:03:33,000 --> 00:03:34,007
from Greenwich Mean Time,
65
00:03:34,007 --> 00:03:37,002
so five hours behind the time in London
66
00:03:37,002 --> 00:03:39,003
which is the timezone for New York City.
67
00:03:39,003 --> 00:03:42,005
Of course we can use the date and time together,
68
00:03:42,005 --> 00:03:45,005
the date comes first inside the datetime attribute
69
00:03:45,005 --> 00:03:50,001
and then the time, we can put a T between the date and time
70
00:03:50,001 --> 00:03:52,005
or we can put a space there.
71
00:03:52,005 --> 00:03:55,004
There are many slightly different ways to format
72
00:03:55,004 --> 00:03:56,009
the machine-readable daytime
73
00:03:56,009 --> 00:03:59,007
that are all allowed, all correct.
74
00:03:59,007 --> 00:04:02,002
These rules for machine format a dates
75
00:04:02,002 --> 00:04:04,004
are not just for HTML.
76
00:04:04,004 --> 00:04:06,001
This is how dates and times get formatted
77
00:04:06,001 --> 00:04:08,003
for a lot of programming languages.
78
00:04:08,003 --> 00:04:10,007
There are hundreds of possible combinations
79
00:04:10,007 --> 00:04:12,002
that are all allowed.
80
00:04:12,002 --> 00:04:15,009
Definitely look this up when you need to know how to do it.
81
00:04:15,009 --> 00:04:19,005
The time element with its datetime attribute
82
00:04:19,005 --> 00:04:22,005
is how we communicate time semantically,
83
00:04:22,005 --> 00:04:27,000
so that the computers out there can understand when.
6401
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.