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 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #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

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
RIGHT JOIN in PostgresPostgresCONCAT and CONCAT_WS Functions in PostgresPostgresHow to deploy Angular App on Dreamhost or Amazon S3 or firebase?AngularWhat does it mean by Continuous Integration, Continuous Delivery and Continuous Deployment?MiscellaneousHow to hide and show menu on scroll using JavaScript and CSS?CSSSocial Media Colors: Sass VariablesMiscellaneousHow to check if checkbox is checked or not using JavaScript?JavaScriptHow to load variables, functions, and mixins from another module in SCSS?SCSSHAVING Clause in Postgres with Examples in All Aggregate FunctionsPostgresHow to add Go Back button in Swift 5?SwiftThe flex-grow, flex-shrink and flex-basis Properties in CSSCSSHow to host Google fonts on your server and add them using CSS?CSS