PHP code example of naif / world-clock

1. Go to this page and download the library: Download naif/world-clock library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

naif / world-clock example snippets


namespace App\Providers;

[...]

use Naif\WorldClock\WorldClock;

class NovaServiceProvider extends NovaApplicationServiceProvider
{

[...]

  public function card()
  {
      return [
         (new WorldClock())
            ->timezones([
                'Asia/Tokyo',
                'Asia/Dubai',
                'America/new_york',
                'America/los_angeles',
            ])
            ->timeFormat('h:i') //Optional time format default is: 'h:i:s'
            ->updatePeriod(1000) //Optional to set updating time period in millisecond default is 1000 ms = 1 second
      ];
  }

[...]

}