Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
- Dates, let's talk about dates and times.
If you've done any programming in any language,
and you know that handling dates and times
can get messy quick, well not so much in HTML.
HTML simply has one element that we use to mark anything
that's specifying a time of day, a date, or span of time,
the time element.
We use the time element to format a date or time,
anything that's related to a specific moment or range
in time, into something other computers can understand.
The time element has an opening and a closing tag,
the opening time tag, May 8th the closing time tag.
Or like this with year, May 8th 2025.
Well or some people write dates like that,
others write it like this 8th May 2025.
We can use any human understandable format
for the phrase of text that's between the tags.
That's what will get displayed on the webpage,
that's what other humans will see.
But the whole point of this element is to convey
to computers exactly when this date or time is.
For that, we use what's called an HTML attribute.
Now we haven't talked about HTML attributes yet,
we can put an attribute on any HTML element.
And I'll get into that in a later video,
but let's just start with the attribute
that will give us a place to put data,
about when this date or time is.
Data that a computer will understand.
We've already learned that the element name goes first,
right after the opening less than sign.
Then let's type a space and right the attribute name,
followed by equals and the attribute value inside quotes.
For the time element,
we're going to use the date time attribute data.
Datetime all one word, datetime equals 2025 dash 05 dash 08.
The time inside the date time attribute,
needs to be in a specific format.
There's a specific machine-readable format
for dates and times, and we have to use that.
Let's look at some more examples May 8th is conveyed 05, 08.
With a year no matter how its phrase for humans,
the machine-readable version in the datetime attribute
is written, 2025 dash 05, dash 08,
the year and four digits then the month in two digits,
and then the date in two digits.
Or maybe we don't have a date,
and we just have the month and the year.
Or maybe we just have the year.
We don't have to write out the date on the web page.
Lots of times sites will use time stamps
with phrases like five hours ago or 10 days ago,
but the attributes still uses
a proper machine-readable version,
anything is allowed for humans.
The machines want a very standardized format,
we can also mark up times with the time element.
The machine-readable version wants numbers
in the 24 hour clock format, we can include seconds
and fractions of a second or not.
We can include the time zone 15 45 minus 05 00,
means 15 45 or 3:45pm
in the time zone that's minus five hours
from Greenwich Mean Time,
so five hours behind the time in London
which is the timezone for New York City.
Of course we can use the date and time together,
the date comes first inside the datetime attribute
and then the time, we can put a T between the date and time
or we can put a space there.
There are many slightly different ways to format
the machine-readable daytime
that are all allowed, all correct.
These rules for machine format a dates
are not just for HTML.
This is how dates and times get formatted
for a lot of programming languages.
There are hundreds of possible combinations
that are all allowed.
Definitely look this up when you need to know how to do it.
The time element with its datetime attribute
is how we communicate time semantically,
so that the computers out there can understand when.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.