Home / Snippets / How to Add Timezones Fields in Laravel Migration
How to Add Timezones Fields in Laravel Migration cover

How to Add Timezones Fields in Laravel Migration

807

2 years ago

0 comments

To add a timezone field in Laravel migration, you can specify the field/column to have timezone by using "timestampsTz()" method. Since the common way is to use "timestamps()" you can replace it to use the timezone method.

Schema::create('users', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->timestampsTz();
});

Once you have run the migration, now you will be able to specify the timezone for the timestamp.
notion avatar

Ahmad Aziz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Post Tutorials

Learn trending tutorials for ReactJs, React Native, VueJS, NextJs, Laravel, Tailwind CSS, and Flutter development.
View Tutorials

Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your web projects
View Components

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this