PHP code example of brainlet-ali / laravel-convert-timezone
1. Go to this page and download the library: Download brainlet-ali/laravel-convert-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/ */
brainlet-ali / laravel-convert-timezone example snippets
use Brainlet\LaravelConvertTimezone\Traits\ConvertTZ;
class Post extends Model
{
use ConvertTZ;
}
// That's it! All datetime fields now automatically convert to your configured timezone
$post = Post::first();
echo $post->created_at; // 2024-01-15 09:30:00 (in America/New_York instead of UTC)