<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Current Date and Time</title>
    <script>
        function updateDateTime() {
            // Get the current date and time
            var now = new Date();
            var year = now.getFullYear();
            var month = ('0' + (now.getMonth() + 1)).slice(-2);
            var day = ('0' + now.getDate()).slice(-2);
            var hours = ('0' + now.getHours()).slice(-2);
            var minutes = ('0' + now.getMinutes()).slice(-2);
            var seconds = ('0' + now.getSeconds()).slice(-2);

            // Format the date and time as YYYY-MM-DD HH:MM:SS
            var formattedDateTime = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;

            // Update the value of the dateTime input field
            document.getElementById('dateTime').value = formattedDateTime;
        }

        // Update the date and time every second
        setInterval(updateDateTime, 1000);

        // Ensure the initial value is set when the page loads
        window.onload = updateDateTime;
    </script>
</head>
<body>
   <form  method="post">
   <h1>Current Date and Time</h1>
    <input type="text" name="a" id="dateTime" >
    <button type="submit" name="sub1">print</button>
   </form>
</body>
</html>


<?php
                    
                    if(isset($_POST['sub1']))
                    {
                    
                    
                    
                    $a=$_POST['a'];
                  
                    
                    $da=date('Y-M-D');
                    
                    echo $a;
                    
                    
                                // $ins=mysqli_query($db,"insert into service values('0','$a','$b','$c','$d','$e','$f','$a7','$a8','$a9')");
                    
                             msg(" $a","service.php");
                    
                           
                    }
                    
                    ?>
