-1

Can someone can show me how to create time/date ticking in Codeigniter and explain that code? I am really confused right now, because started learning CI few days ago. I woud love to take date and time from server not from user PC. This is what ive done so far and stucked.

this is view file

    <script>
    $(document).ready(function() {
            setInterval(timestamp, 1000);
        });

        function timestamp() {
            $.ajax({
            url: 'index.php',
            success: function(data) {
                $('#timestamp').html(data);
            },
        });
    }

    </script>
</head>
<body>
    <div class = "page">
        <header>
            <time id="timestamp">
                <?php
                    date_default_timezone_set('YOUR TIMEZONE');
                    echo date('l d F Y - H:i:s');
                ?>
            </time>
Karlis Pokkers
  • 224
  • 5
  • 18

1 Answers1

0

The task you want to achieve will be achieved by Javascript and not by Codeigniter. Read this post : Creating real time ticking clock

Community
  • 1
  • 1
Ash Singh
  • 3,921
  • 2
  • 25
  • 30