Bản mẫu:Đồng hồ kĩ thuật số
Bản mẫu đồng hồ này sử dụng một trong những cấu trúc mã phức tạp nhất để hiển thị một chiếc đồng hồ điện tử hiển thị thời gian theo múi giờ bạn chọn!
Cách sử dụng
sửa- To use this template, place the following on the page -
{{Digital clock}}
- This template should never be substituted.
- This template should be purged to reflect current time.
- If your area follows DST, you will have yo change the time manually.
Các tham số
sửaAll parameters given below are optional and not necessarily be used.
{{Digital clock
|format = 12 or 24 (default: 24)
|offset = number of hours + or - UTC (default: 0)
|size = width of each digit in pixels (default: 70)
|color = any color name or HTML color code (default: red)
}}
Múi giờ
sửaThe clock has a parameter that allows you to give an offset from UTC time. The offset can be fractional to adjust the time by any number of hours and minutes. Therefore this code -
{{Digital clock|offset = +5.5}}
will produce this clock:
Định dạng 12 hay 24 giờ
sửa {{Digital clock|format = 12}}
will produce: Kích thước
sửa {{Digital clock|size = 20px}}
and it will display something like this: Màu sắc
sửa {{Digital clock|color = cyan}}
and it will display something like this: Đường viền
sửaThis is actually not a parameter but a way to design different types of borders for the clock. Normal HTML can be used to add borders and padding space. One tricky bit is that <div> elements expand to the full width of their container, which will make the box too wide. So we must specify an exact width for it, by multiplying the segment size by 5 (for 24-hour clocks) or 6 (for 12-hour clocks): A complete list of borders is available at the User Page Design Center
<div style="background:black; padding:5px 15px; border:3px inset cyan; width:300px;">
{{Đồng hồ kĩ thuật số}}
</div>
<div style="background:black; padding:5px 15px; border:3px inset cyan; -moz-border-radius:15px; -webkit-border-radius:15px; width:300px;">
{{Đồng hồ kĩ thuật số}}
</div>
Đồng hồ dọc
sửaWrapping the clock in a <div> with the same width as the segments will make it vertical. Borders work as normal. The vertical clock isn't displayed to prevent inconvenience but this code works perfectly.
<div style="float:right; width:40px; border:5px solid black">
{{Digital clock}}
</div>
Thay đổi màu sắc ngẫu nhiên
sửaParser magic can be used to pick a random color each time the page is generated. Use the following code to pick random clors from the colors specified. Note - You can change the colors given according to your preference. This code will produce the clock given below.
{{Digital clock |color = {{#switch:{{#expr:{{#time:U}} mod 6}} |0=red |1=orange |2=lime |3=yellow |4=cyan |5=magenta}}
Xem thêm
sửaMultiple units of time
sửaType | Adjustable | Current | Last | Next |
---|---|---|---|---|
Date and Time | {{time}} | {{Currentdate}} (MDY) {{Plain now}} (DMY) {{Now}} (DMY in a complete sentence) {{Simple now}} |
||
Date Only | {{Dateonly}} {{Datedow}} (Has the day of the week) |
{{Date}} (Chose format) {{DATE}} (prefixed by date=) {{TODAY}} (DMY) |
{{Yesterday}} {{Day-1}} |
{{Tomorrow}} {{Day+1}} |
Time only | {{Timeonly}} | {{CURRENTTIME}} (12 h format) {{CURRENTTIME24}} (24 h format) |
||
Banners | {{Right now}} (Blue with time and number of Wikipedia articles) |
|||
Timestamp | {{Timestamp}} (Format YYYYMMDDhhmmss) |
Single units of time
sửaUnit of time | Adjustable | Current | Last | Next |
---|---|---|---|---|
SECOND | {{CURRENTSECOND}} | |||
MINUTE | {{CURRENTMINUTE}} | |||
HOUR | {{Currenthour}} | {{Hour-1}} | {{Hour+1}} | |
WEEK | {{CURRENTWEEKOFYEAR}} {{CURRENTWEEKOFMONTH}} |
|||
Day of Week | {{Dow}} | {{CURRENTWEEKDAYNAME}} {{CURRENTWEEKDAYABBREV}} {{CURRENTWEEKDAY}} |
{{LASTWEEKDAYNAME}} {{LASTWEEKDAYABBREV}} |
{{NEXTWEEKDAYNAME}} {{NEXTWEEKDAYABBREV}} |
MONTH | {{MONTHNAME}} {{MONTHABBREV}} {{MONTHNUMBER}} {{MONTH}} (zero padded) |
{{Currentmonth}} {{CURRENTMONTHABBREV}} {{CURRENTMONTHNUMBER}} {{CURRENTMONTHDAYS}} |
{{LASTMONTH}} (Can make not zero-padded) {{LASTMONTHNAME}} {{LASTMONTHABBR}} |
{{NEXTMONTH}} (Can make not zero-padded) {{NEXTMONTHNAME}} {{NEXTMONTHABBR}} |
Day of Month | {{Currentday}} | |||
YEAR | {{CURRENTYEARCC}} {{CURRENTYEARYY}} {{CURRENTISOYEAR}} {{CURRENTYEAR}} |
{{LASTYEAR}} | {{NEXTYEAR}} | |
Day of Year | {{CURRENTDAYOFYEAR}} | |||
DECADE | {{DECADE}} | {{CURRENTDECADE}} | {{LASTDECADE}} | {{NEXTDECADE}} |
CENTURY | {{CENTURY}} | {{CURRENTCENTURY}} | {{LASTCENTURY}} | {{NEXTCENTURY}} |
MILLENNIUM | {{MILLENNIUM}} | {{Currentmillennium}} |
Date and time Templates made for substitution:
sửaMonth:
{{Lmonth}} produces Bản mẫu:Lmonth
{{Nmonth}} produces Bản mẫu:Nmonth
{{LastMonth}} produces Bản mẫu:LastMonth
{{NextMonth}} produces Bản mẫu:NextMonth
Individual Templates
sửa- {{Calendar}}
- {{Calendar clock with Wikipedia stats}}
- {{Clock}}
- {{Digital clock}}
- {{Digital clock and date}}
- Category:Bản mẫu lịch, ngày tháng và thời gian
- Category:Date-computing templates
- Category:Date-computing templates based on current time
- Category:ISO date templates
- Category:Bản mẫu lịch
- Category:Bản mẫu đồng hồ