How do I set indian timezone in laravel?

By Guest | Feb 13, 2022 | Laravel
Share : Whatsapp

https://www.fundaofwebit.com/post/how-to-set-indian-timezone-in-laravel

How do I set indian timezone in laravel?


In this post, we are going to see how to set timezone in laravel and php.


Example 1: Setup Timezone in Laravel.

Go to config/app.php file and search for 'timezone' and replace with below code:

'timezone' => 'Asia/Kolkata',


Example 2: Setup Timezone in laravel with env file:

Step 1: Go to config/app.php file, search for 'timezone' and replace with the below code

'timezone' => env('APP_TIMEZONE', 'UTC'),

Step 2: Go to .env file and add the below code:

APP_TIMEZONE="Asia/Kolkata"


Example 3: Setup Timezone in PHP:

<?php
    date_default_timezone_set("Asia/Kolkata");   //India time (GMT+5:30)
    echo date('d-m-Y H:i:s');
?>


Thanks for reading.