YALLS I HAVE A QUESTION

okay so, this website uses HTML code to make the profiles look the way they do right? do u guys know if there is a way to show what time it is currently in my timezone? i cooked up some code that would display a timezone of choice, however i don't really know how to set it in my profile, if anyone knows ID REALLY APPRECIATE IT, i'll leave the code here for anyone to tinker with

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Current Time</title>

    <style>

        body {

            font-family: Arial, sans-serif;

            display: flex;

            justify-content: center;

            align-items: center;

            height: 100vh;

            background-color: #f0f0f0;

        }

        .time {

            font-size: 2em;

            color: #333;

        }

    </style>

</head>

<body>

    <div class="time" id="time"></div>


    <script>

        function updateTime() {

            // Set your timezone here, e.g., 'America/New_York', 'Europe/London', etc.

            const options = { timeZone: 'America/New_York', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: true };

            const now = new Date();

            const timeString = now.toLocaleTimeString('en-US', options);

            document.getElementById('time').innerText = timeString;

        }


        updateTime();

        setInterval(updateTime, 1000); // Update the time every second

    </script>

</body>

</html>



0 Kudos

Comments

Displaying 0 of 0 comments ( View all | Add Comment )