<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Changes in PHP datetime support</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="migration52.error-messages.html">New Error Messages</a></div> <div class="next" style="text-align: right; float: right;"><a href="migration52.parameters.html">New Parameters</a></div> <div class="up"><a href="migration52.html">Migrating from PHP 5.1.x to PHP 5.2.x</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="migration52.datetime" class="section"> <h2 class="title">Changes in PHP <a href="ref.datetime.html" class="link">datetime</a> support</h2> <p class="para"> Since PHP 5.1.0, there has been an extension named <em>date</em> 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.html#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"><var class="varname">TZ</var></var> environmental variable </span> </li> <li class="listitem"> <span class="simpara"> from your script using the convenience function <span class="function"><a href="function.date-default-timezone-set.html" class="function">date_default_timezone_set()</a></span> </span> </li> </ul> <p class="para"> All supported <a href="timezones.html" class="link">timezones</a> are listed in the PHP Manual. </p> <p class="para"> With the advent of PHP 5.2.x, there are <span class="type"><a href="language.types.object.html" class="type object">object</a></span> representations of the date and timezone, named <em>DateTime</em> and <em>DateTimeZone</em> respectively. The methods map to existing procedural date functions. </p> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="migration52.error-messages.html">New Error Messages</a></div> <div class="next" style="text-align: right; float: right;"><a href="migration52.parameters.html">New Parameters</a></div> <div class="up"><a href="migration52.html">Migrating from PHP 5.1.x to PHP 5.2.x</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>