Yogesh Chauhan's Blog

How to set default timezone using PHP?

in PHP on February 25, 2021

PHP has date_default_timezone_set() function that we can use to set the default timezone.

Here’s how to use this function:


echo date_default_timezone_get();




echo date_default_timezone_get();


Be careful, when you set the timezone, it will set in all date functions used inside the page. No matter what country it is, it will be that set timezone in all date functions.

Here is the list of all supported timezones.

It will return FALSE is you don’t pass the valid timezone.

Most Read

#1 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #2 How to add Read More Read Less Button using JavaScript? #3 How to check if radio button is checked or not using JavaScript? #4 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #5 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
Killing A Project Part 4: What Would Be Your Top 3 Priorities For Planning The Cancellation?MiscellaneousWordPress: How to get field values in Advanced Custom Fields?WordPressVariables and Distance Functions in SCSS (Sass)SCSSHow does Binding work in JavaScript?JavaScriptHow to hide a DIV on clicks outside of it using jQuery?jQueryHow to change perception and behavior of a person for acceptance of new systems?MiscellaneousHow to create a link tag button using CSS?CSSCan we execute conditions in SQL?SQL/MySQLHow to create a sticky menu pin using CSS?CSSAvoid using new Array() in JavaScriptJavaScriptRIGHT JOIN in PostgresPostgresAn Introduction to wp-config file in WordPressWordPress