PHP code example of lexiandev / laravel-timezone

1. Go to this page and download the library: Download lexiandev/laravel-timezone 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/ */

    

lexiandev / laravel-timezone example snippets


{{ Timezone::convertToLocal($post->created_at) }}

@displayDate($post->created_at)

{{ Timezone::convertToLocal($post->created_at) }}

// 4th July 2018 3:32:am

{{ Timezone::convertToLocal($post->created_at, 'Y-m-d g:i', true) }}

// 2018-07-04 3:32 New York, America

@displayDate($post->created_at)

// 4th July 2018 3:32:am

@displayDate($post->created_at, 'Y-m-d g:i', true)

// 2018-07-04 3:32 New York, America

$post = Post::create([
    'publish_at' => Timezone::convertFromLocal($request->get('publish_at')),
    'description' => $request->input('description'),
]);

php artisan vendor:publish --provider="Lexiandev\LaravelTimezone\LaravelTimezoneServiceProvider" --tag=config

php artisan vendor:publish --provider="Torann\GeoIP\GeoIPServiceProvider" --tag=config

php artisan vendor:publish --provider="Lexiandev\LaravelTimezone\LaravelTimezoneServiceProvider" --tag=migrations

php artisan migrate