Source of: /manual/en/migration52.datetime.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/migration52.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'migration52.datetime.php',
1 => 'Changes in PHP datetime
support',
),
'up' =>
array (
0 => 'migration52.php',
1 => 'Migrating from PHP 5.1.x to PHP 5.2.x',
),
'prev' =>
array (
0 => 'migration52.error-messages.php',
1 => 'New Error Messages',
),
'next' =>
array (
0 => 'migration52.parameters.php',
1 => 'New Parameters',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="migration52.datetime" class="section">
<h2 class="title">Changes in PHP <a href="ref.datetime.php" class="link">datetime</a>
support</h2>
<p class="para">
Since PHP 5.1.0, there has been an extension named <i>date</i>
in the PHP core. This is the new implementation of PHP's datetime support.
Although it will attempt to guess your system's timezone setting, you
should set the timezone manually. You can do this in any of three ways:
</p>
<ul class="itemizedlist">
<li class="listitem">
<span class="simpara">
in your <var class="filename">php.ini</var> using the
<a href="datetime.configuration.php#ini.date.timezone" class="link">date.timezone</a> INI directive
</span>
</li>
<li class="listitem">
<span class="simpara">
on your system using the <var class="varname">TZ</var> environmental variable
</span>
</li>
<li class="listitem">
<span class="simpara">
from your script using the convenience function
<a href="function.date-default-timezone-get.php" class="link"><a href="function.date-default-timezone-set.php" class="function">date_default_timezone_set()</a></a>
</span>
</li>
</ul>
<p class="para">
All supported <a href="timezones.php" class="link">timezones</a> are listed
in the PHP Manual.
</p>
<p class="para">
With the advent of PHP 5.2.x, there are <a href="language.types.object.php" class="type object">object</a> representations of the
date and timezone, named <i>DateTime</i> and <i>DateTimeZone</i> respectively.
The methods map to existing procedural date functions.
</p>
</div><?php manual_footer(); ?>