Contoh
Unsur waktu dengan atribut datetime mesin-dibaca:
<p>I have a date on <time datetime="2017-02-14">Valentines
day</time>.</p>
Cobalah sendiri " Definisi dan Penggunaan
The datetime atribut mewakili dibaca mesin tanggal / waktu <time> elemen.
Contoh tanggal dan waktu hukum:
Dates:
<time datetime="1914">
<!-- means the year 1914 -->
<time datetime="1914-12">
<!-- means December 1914 -->
<time datetime="1914-12-20">
<!-- means 20 December 1914 -->
<time datetime="12-20">
<!-- means 20 December any year -->
<time datetime="1914-W15">
<!-- means week 15 of year 1914 -->
Date and Times:
<time datetime="1914-12-20T08:00">
<!-- means 20 December 1914 at 8am -->
<time datetime="1914-12-20
08:00"> <!-- also means 20 December 1914 at 8am -->
<time datetime="1914-12-20
08:30:45"> <!-- with minutes and seconds -->
<time datetime="1914-12-20
08:30:45.687"> <!-- with minutes, seconds, and
milliseconds -->
Times:
<time datetime="08:00">
<!-- means 8am -->
<time datetime="08:00-03:00">
<!-- means 8am in Rio de Janeiro (UTC-3 hours) -->
<time datetime="08:00+03:00">
<!-- means 8am in Madagascar (UTC+3 hours) -->
Durations:
<time datetime="P2D"> <!--
means a duration of 2 days -->
<time datetime="PT15H10M">
<!-- means a duration of 15 hours and 10 minutes -->
Dukungan Browser
Atribut | |||||
---|---|---|---|---|---|
datetime | iya nih | iya nih | iya nih | iya nih | iya nih |
Perbedaan Antara HTML 4.01 dan HTML5
The <time> tag yang baru di HTML5.
Sintaksis
<time datetime="YYYY-MM-DDThh:mm:ssTZD">
atribut Nilai
Nilai | Deskripsi |
---|---|
YYYY-MM-DDThh:mm:ssTZD or PTDHMS | Tanggal atau waktu yang ditentukan. Penjelasan komponen:
|