{"id":233,"date":"2025-04-08T11:31:00","date_gmt":"2025-04-08T11:31:00","guid":{"rendered":"https:\/\/456.fi\/?page_id=233"},"modified":"2025-04-12T07:41:53","modified_gmt":"2025-04-12T07:41:53","slug":"kello-testi","status":"publish","type":"page","link":"https:\/\/456.fi\/index.php\/kello-testi\/","title":{"rendered":"Kello Testi"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html>\n&lt;html lang=\"fi\">\n&lt;head>\n    &lt;meta charset=\"UTF-8\">\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    &lt;title>Time and Date Display&lt;\/title>\n    &lt;style>\n        body {\n            font-family: Arial, sans-serif;\n            text-align: center;\n            margin-top: 50px;\n        }\n         #timeOfDay {\n            background-color: #0000FF; \/* Sininen *\/\n            padding: 20px;\n            border-radius: 10px;\n            margin-top: 20px;\n            font-size: 4em;\n        }\n\t#weekday {\n            background-color: #FF0000; \/* Punainen *\/\n            padding: 20px;\n            border-radius: 10px;\n            margin-bottom: 20px;\n            font-size: 4em;\n        }\n        #date {\n            background-color: #D3D3D3; \/* Harmaa *\/\n            padding: 20px;\n            border-radius: 2px;\n\t    font-size: 4em;\n        }\n        #time {\n            background-color: #FFFFFF; \/* Sininen *\/\n            padding: 20px;\n            border-radius: 10px;\n            margin-top: 20px;\n\t    font-size: 8em;\n        }\n       \n    &lt;\/style>\n&lt;\/head>\n&lt;body>\n    &lt;div id=\"weekday\">&lt;\/div>\n    &lt;div id=\"timeOfDay\">&lt;\/div>\n    &lt;h2 id=\"time\">&lt;\/h2>\n    &lt;h1 id=\"date\">&lt;\/h1>\n\n    &lt;script>\n        function updateTime() {\n            const now = new Date();\n            const hours = now.getHours();\n            const minutes = now.getMinutes();\n            const seconds = now.getSeconds();\n            const day = now.getDate();\n            const month = now.getMonth() + 1; \/\/ Months are zero-based\n            const year = now.getFullYear();\n            const weekdayNames = &#91;\"Sunnuntai\", \"Maanantai\", \"Tiistai\", \"Keskiviikko\", \"Torstai\", \"Perjantai\", \"Lauantai\"];\n            const weekday = weekdayNames&#91;now.getDay()];\n\n            \/\/ Format time\n            const formattedTime = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;\n            document.getElementById('time').textContent = formattedTime;\n\n            \/\/ Format date\n            const formattedDate = `${day.toString().padStart(2, '0')}\/${month.toString().padStart(2, '0')}\/${year}`;\n            document.getElementById('date').textContent = formattedDate;\n\n            \/\/ Display weekday\n            document.getElementById('weekday').textContent = weekday;\n\n            \/\/ Determine time of day\n            let timeOfDay = '';\n            if (hours >= 5 &amp;&amp; hours &lt; 12) {\n                timeOfDay = 'Aamu';\n            } else if (hours >= 12 &amp;&amp; hours &lt; 15) {\n                timeOfDay = 'P\u00e4iv\u00e4';\n            } else if (hours >= 15 &amp;&amp; hours &lt; 18) {\n                timeOfDay = 'Iltap\u00e4iv\u00e4';\n            } else if (hours >= 18 &amp;&amp; hours &lt; 21) {\n                timeOfDay = 'Ilta';\n            } else {\n                timeOfDay = 'Y\u00f6';\n            }\n            document.getElementById('timeOfDay').textContent = timeOfDay;\n        }\n\n        setInterval(updateTime, 1000);\n        updateTime(); \/\/ Initial call to display time immediately\n    &lt;\/script>\n&lt;\/body>\n&lt;\/html><\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-233","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/456.fi\/index.php\/wp-json\/wp\/v2\/pages\/233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/456.fi\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/456.fi\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/456.fi\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/456.fi\/index.php\/wp-json\/wp\/v2\/comments?post=233"}],"version-history":[{"count":5,"href":"https:\/\/456.fi\/index.php\/wp-json\/wp\/v2\/pages\/233\/revisions"}],"predecessor-version":[{"id":240,"href":"https:\/\/456.fi\/index.php\/wp-json\/wp\/v2\/pages\/233\/revisions\/240"}],"wp:attachment":[{"href":"https:\/\/456.fi\/index.php\/wp-json\/wp\/v2\/media?parent=233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}