Date.getHours() 會依本地時間回傳日期物件中的小時,範圍為 0 到 23。
new Date().getHours()
這個方法常用於時鐘顯示、營業時間判斷與排程邏輯。
若需要 UTC 小時,可使用 getUTCHours()。