×

在自己的網站上放置免費、可隨心所欲調整樣式的時間小工具

想要在自己網站上顯示一個精確的時間?還是今天的日期、日出日落時間或晝長?只要從下列選項選擇並複製語法你就可以做到!完全免費!

選擇

地點
美国紐約
想要顯示其他地點?請使用右上角的搜尋欄位
要顯示的項目




時間格式



日期格式




 
天:
dayname星期一
dname週一
daynum01-31
dnum1-31
day_in_y天 1-366
周數:
week12
月:
monthname三月
monthnum01-12
mnum1-12
年:
year2024
yy24
顏色與大小
px
你的選擇結果看起來是這樣
紐約 目前的時間:
由於各網頁的Style Sheets有所差異,最終的結果也許會有所不同
你可以用CSS任意調整widget

這是屬於你的時鐘小工具的原始碼

使用條款

進階使用

There are two widget scripts: A simplified version,, which displays only time, and the main widget script,, which can display time, date, sunrise time, sunset time and day length. The main widget script is available in several languages. For other languages, replace zh_tw in the script name with the code for the desired language. 有兩個小工具語法:簡單版 t.js ,僅顯示時間。完整版 zh_tw.js ,可顯示時間/日期/日出日落/晝長。完整版小工具提供數種語言版本,用語言代碼替換原始碼檔名中的 zh_tw 即可。(例如波蘭文版是pl.js,土耳其文版是tr.js)

init function接受的參數:

參數可用關鍵字預設值
templateTIME, DATE, SUNTIME
time_formathours, minutes, seconds, 12hours, AMPMhours:minutes:seconds
date_formatdayname, dname, daynum, dnum, day_in_y, week, monthname, monthnum, mnum, yy, yearyear-monthnum-daynum
sun_formatsrhour, srminute, sr12hour, srAMPM, sshour, ssminute, ss12hour, ssAMPM, dlhours, dlminutessrhour:srminute-sshour:ssminute
coords地點的經緯度,顯示日升日落資訊必須提供。
id為了讓伺服器識別地點和時區,若地點名稱包含非ASCII字元或您更改了HTML元素的ID,請提供。
callback每秒都會被呼叫的function名稱,會將準備好輸出的template作為參數(選擇性)

參數名稱和關鍵字大小有別。您可以增加HTML和其他內容到 template, time_format, date_formatsun_format 參數

可以這樣建立數個時鐘:

UTC time: <span id="UTC_za00"></span><br/>
New York sunrise time: <span id="New_York_z161"></span><br/>
Tokyo sunrise time: <span id="Tokyo_z444"></span><br/>
Find the <a href="https://time.is/" id="time_is_link" rel="nofollow">current time for any location or time zone on Time.is!</a>
<script src="//widget.time.is/zh_tw.js"></script>
<script>
time_is_widget.init({
	UTC_za00 : {},
	New_York_z161 : {
		template: "SUN",
		sun_format: "srhour:srminute",
		coords: "40.71427,-74.00597"
		},
	Tokyo_z444 : {
		coords: "59.33258,18.06490"
		}
	});
</script>

結果:

UTC time:
New York sunrise time:
Tokyo sunrise time:
Find the current time for any location or time zone on Time.is!

time_format, date_format, sun_format and template 等參數的值會被繼承,所以若已經在前面的小工具中指定了需要的參數,不需要重複指定。

 
 
2024年三月18日,星期一,第12週
太陽: ↑ 07:00 ↓ 19:08 (12小時 8分) - 更多資訊 - 設定紐約為居住地 - 從喜愛的地點中移除