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 How to check if radio button is checked or not using JavaScript? #2 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#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 #Jan 14 How to display a student’s individual transcript in Colleague? #Jan 11 How to install PuTTY on a MacOS?
You might also like these
Relative Length Units in CSSCSSWhat are CSS Specificity Rules and how does browser apply them?CSSUNION and UNION ALL in PostgresPostgresSolution to “TypeError: ‘x’ is not iterable” in Angular 9AngularThe Difference Between the echo and print Commands in PHPPHPHow to Create a Backup From Any Database in SQL?SQL/MySQLThe 7 Security Objectives of Any Organization for IT and Network SecurityMiscellaneousWordPress Plugin: Things to knowWordPressHow to show widgets on the Appearance tab in WordPress?WordPressShould we ever delete data from a database?MiscellaneousHow to disable the Recovery Mode in WordPress?WordPressHow to create a link tag button using CSS?CSS