<script type="text/javascript">    
    //fungsi displayTime yang dipanggil di bodyOnLoad dieksekusi tiap 1000ms = 1detik
    function tampilkanwaktu(){
        //buat object date berdasarkan waktu saat ini
        var waktu = new Date();
        //ambil nilai jam, 
        //tambahan script + "" supaya variable sh bertipe string sehingga bisa dihitung panjangnya : sh.length
        var sh = waktu.getHours() + ""; 
        //ambil nilai menit
        var sm = waktu.getMinutes() + "";
        //ambil nilai detik
        var ss = waktu.getSeconds() + "";
        //tampilkan jam:menit:detik dengan menambahkan angka 0 jika angkanya cuma satu digit (0-9)
        document.getElementById("clock").innerHTML = (sh.length==1?"0"+sh:sh) + ":" + (sm.length==1?"0"+sm:sm) + ":" + (ss.length==1?"0"+ss:ss);
    }
</script>

<!-- Navbar -->
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#"><i class="fas fa-bars"></i></a>
      </li>
      <!--<li class="nav-item d-none d-sm-inline-block">
        <a href="<?php echo base_url() ?>" class="nav-link">Dashboard</a>
      </li>-->
      <li class="nav-item d-none d-sm-inline-block">
        <a href="<?php echo base_url('dashboard') ?>" class="nav-link">Home</a>
      </li>
      
    </ul>

    <!-- SEARCH FORM 
    <form class="form-inline ml-3">
      <div class="input-group input-group-sm">
        <input class="form-control form-control-navbar" type="search" placeholder="Search" aria-label="Search">
        <div class="input-group-append">
          <button class="btn btn-navbar" type="submit">
            <i class="fas fa-search"></i>
          </button>
        </div>
      </div>
    </form>-->

    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
       <li class="nav-item d-none d-sm-inline-block">
        <a class="nav-link text-nowrap">
          <i class="fas fa-calendar-alt"></i> 
          <?php
          $hari = date('l');
          /*$new = date('l, F d, Y', strtotime($Today));*/
          if ($hari=="Sunday") {
            echo "Minggu";
          }elseif ($hari=="Monday") {
            echo "Senin";
          }elseif ($hari=="Tuesday") {
            echo "Selasa";
          }elseif ($hari=="Wednesday") {
            echo "Rabu";
          }elseif ($hari=="Thursday") {
            echo("Kamis");
          }elseif ($hari=="Friday") {
            echo "Jum'at";
          }elseif ($hari=="Saturday") {
            echo "Sabtu";
          }
          ?>,
          <?php
          $tgl =date('d');
          echo $tgl;
          $bulan =date('F');
          if ($bulan=="January") {
            echo " Januari ";
          }elseif ($bulan=="February") {
            echo " Februari ";
          }elseif ($bulan=="March") {
            echo " Maret ";
          }elseif ($bulan=="April") {
            echo " April ";
          }elseif ($bulan=="May") {
            echo " Mei ";
          }elseif ($bulan=="June") {
            echo " Juni ";
          }elseif ($bulan=="July") {
            echo " Juli ";
          }elseif ($bulan=="August") {
            echo " Agustus ";
          }elseif ($bulan=="September") {
            echo " September ";
          }elseif ($bulan=="October") {
            echo " Oktober ";
          }elseif ($bulan=="November") {
            echo " November ";
          }elseif ($bulan=="December") {
            echo " Desember ";
          }
          $tahun=date('Y');
          echo $tahun;
          ?>
          &nbsp;-&nbsp; 
          <body onload="tampilkanwaktu();setInterval('tampilkanwaktu()', 1000);">               
          <span id="clock"></span> 
        </a>
      </li>     
    
      <li class="nav-item d-none d-sm-inline-block">
        <a class="nav-link text-success" href="<?php echo base_url('akun') ?>">
          <i class="fas fa-user"></i> <?php echo $this->session->userdata('nama'); ?>          
        </a>
      </li>

      <li class="nav-item" text-danger>
        
        <a class="nav-link text-danger" href="<?php echo base_url('login/logout') ?>" onclick="return confirm('Yakin ingin keluar dari aplikasi ?')">
          <i class="fas fa-sign-out-alt"></i> Logout                      
        </a>
      </li> 

    </ul>
  </nav>
  <!-- /.navbar -->