<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Changes in PHP datetime support</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="Migrating from PHP 5.1.x to PHP 5.2.x" HREF="migration52.html"><LINK REL="PREVIOUS" TITLE="New Error Messages" HREF="migration52.error-messages.html"><LINK REL="NEXT" TITLE="New Parameters" HREF="migration52.parameters.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="section" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="migration52.error-messages.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Apêndice B. Migrating from PHP 5.1.x to PHP 5.2.x</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="migration52.parameters.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="migration52.datetime" >Changes in PHP <A HREF="ref.datetime.html" >datetime</A > support</A ></H1 ><P > Since PHP 5.1.0, there has been an extension named <TT CLASS="literal" >date</TT > 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 ><P ></P ><UL ><LI ><P > in your <TT CLASS="filename" >php.ini</TT > using the <A HREF="missing-stuff.html#ini.date.timezone" >date.timezone</A > INI directive </P ></LI ><LI ><P > on your system using the <TT CLASS="constant" ><B >TZ</B ></TT > environmental variable </P ></LI ><LI ><P > from your script using the convenience function <A HREF="function.date-default-timezone-get.html" ><A HREF="function.date-default-timezone-set.html" ><B CLASS="function" >date_default_timezone_set()</B ></A ></A > </P ></LI ></UL ><P > All supported <A HREF="timezones.html" >timezones</A > are listed in the PHP Manual. </P ><P > With the advent of PHP 5.2.x, there are <A HREF="language.types.object.html" ><B CLASS="type" >object</B ></A > representations of the date and timezone, named DateTime and DateTimeZone respectively. The methods map to existing procedural date functions. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="migration52.error-messages.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="migration52.parameters.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >New Error Messages</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="migration52.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >New Parameters</TD ></TR ></TABLE ></DIV ></BODY ></HTML >