ItSolutionStuff.com

How to set Indian Timezone in Laravel?

By Hardik Savani • December 6, 2024
Laravel

In this post, I will show you how to set indian timezone in laravel application.

By default, Laravel uses the UTC timezone. For Indian users, we can set the timezone to `Asia/Kolkata`. There are two ways to configure the timezone:

Example 1: Update timezone from .env file

.env

APP_TIMEZONE="Asia/Kolkata"

Example 2: Update timezone from config file

You can directly change timezone from config file like the following way:

config/app.php

'timezone' => 'Asia/Kolkata',

You can test it with the following route code:

Route::get('/', function () {
    dd(now());
});

You will see the output like this way:

Illuminate\Support\Carbon @1733495164 {#278 â–¼ // routes/web.php:11
  #endOfTime: false
  #startOfTime: false
  #constructedObjectId: "00000000000001160000000000000000"
  -clock: null
  #localMonthsOverflow: null
  #localYearsOverflow: null
  #localStrictModeEnabled: null
  #localHumanDiffOptions: null
  #localToStringFormat: null
  #localSerializer: null
  #localMacros: null
  #localGenericMacros: null
  #localFormatFunction: null
  #localTranslator: null
  #dumpProperties: array:3 [â–¶]
  #dumpLocale: null
  #dumpDateProperties: null
  date: 2024-12-06 19:56:04.452330 Asia/Kolkata (+05:30)
}

I hopw it can help you...

Tags: Laravel
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

Laravel Datatables Relationship with Filter Column Example

Read Now →

Laravel Eloquent Find with Trashed Record Example

Read Now →

How to Add Toastr Notification in Laravel 11?

Read Now →

Laravel 11 Store JSON Format Data in Database Tutorial

Read Now →

How to Integrate AdminLTE 3 in Laravel 11?

Read Now →

Laravel 11 Event Broadcasting Tutorial

Read Now →

Laravel 11 Confirm Box Before Delete Record from Database

Read Now →

Laravel 11 Localization | Create Multi Language in Laravel 11

Read Now →

Laravel 11 Client Side Form Validation using JQuery

Read Now →

Laravel 11 Pagination Add Query String Example

Read Now →

How to Use Quill Rich Text Editor in Laravel 11?

Read Now →

Laravel 11 Reverb Real-Time Notifications Example

Read Now →