W3Schools.com

PHP date_default_timezone_set() Function


PHP Date Reference Complete PHP Date Reference

Definition and Usage

The date_default_timezone_set() function sets the default timezone used by all date/time functions.

Syntax

date_default_timezone_set(timezone)

Parameter Description
timezone Required. The timezone identifier, like "UTC" or "Europe/Paris". List of valid timezones: http://www.php.net/manual/en/timezones.php


Tips and Notes

Note: This function returns FALSE if the timezone identifier is not valid, or TRUE otherwise.


Example

<?php
echo(date_default_timezone_set("Europe/Paris"));
?>

The output of the code above will be:

1


PHP Date Reference Complete PHP Date Reference
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE