<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >strptime</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="Data e hora" HREF="ref.datetime.html"><LINK REL="PREVIOUS" TITLE="strftime" HREF="function.strftime.html"><LINK REL="NEXT" TITLE="strtotime" HREF="function.strtotime.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" 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="function.strftime.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.strtotime.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.strptime" ></A >strptime</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN27130" ></A ><P > (PHP 5 >= 5.1.0RC1)</P >strptime -- Parse a time/date generated with <A HREF="function.strftime.html" ><B CLASS="function" >strftime()</B ></A > </DIV ><DIV CLASS="refsect1" ><A NAME="AEN27134" ></A ><H2 >Descrição</H2 >array <B CLASS="methodname" >strptime</B > ( string date, string format )<BR ></BR ><P > <B CLASS="function" >strptime()</B > returns an array with the <CODE CLASS="parameter" >date</CODE > parsed, or <TT CLASS="constant" ><B >FALSE</B ></TT > on error. </P ><P > Month and weekday names and other language dependent strings respect the current locale set with <A HREF="function.setlocale.html" ><B CLASS="function" >setlocale()</B ></A > (LC_TIME). </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B >esta função não é implementada na plataforma Windows</P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN27153" ></A ><H2 >Parâmetros</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >date</CODE > (<A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A >)</DT ><DD ><P > The string to parse (e.g. returned from <A HREF="function.strftime.html" ><B CLASS="function" >strftime()</B ></A >) </P ></DD ><DT ><CODE CLASS="parameter" >format</CODE > (<A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A >)</DT ><DD ><P > The format used in <CODE CLASS="parameter" >date</CODE > (e.g. the same as used in <A HREF="function.strftime.html" ><B CLASS="function" >strftime()</B ></A >). </P ><P > For more information about the format options, read the <A HREF="function.strftime.html" ><B CLASS="function" >strftime()</B ></A > page. </P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN27174" ></A ><H2 >Valores de retornado</H2 ><P > Returns an array, or <TT CLASS="constant" ><B >FALSE</B ></TT > on failure. </P ><P > <DIV CLASS="table" ><A NAME="AEN27179" ></A ><P ><B >Tabela 1. The following parameters are returned in the array</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >parameters</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD >tm_sec</TD ><TD >Seconds after the minute (0-61)</TD ></TR ><TR ><TD >tm_min</TD ><TD >Minutes after the hour (0-59)</TD ></TR ><TR ><TD >tm_hour</TD ><TD >Hour since midnight (0-23)</TD ></TR ><TR ><TD >tm_mday</TD ><TD >Day of the month (1-31)</TD ></TR ><TR ><TD >tm_mon</TD ><TD >Months since January (0-11)</TD ></TR ><TR ><TD >tm_year</TD ><TD >Years since 1900</TD ></TR ><TR ><TD >tm_wday</TD ><TD >Days since Sunday (0-6)</TD ></TR ><TR ><TD >tm_yday</TD ><TD >Days since January 1 (0-365)</TD ></TR ><TR ><TD >unparsed</TD ><TD >the <CODE CLASS="parameter" >date</CODE > part which was not recognized using the specified <CODE CLASS="parameter" >format</CODE ></TD ></TR ></TBODY ></TABLE ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN27216" ></A ><H2 >Exemplos</H2 ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN27219" ></A ><P ><B >Exemplo 1. <B CLASS="function" >strptime()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br />$format </font><font color="#007700">= </font><font color="#DD0000">'%d/%m/%Y %H:%M:%S'</font><font color="#007700">;<br /></font><font color="#0000BB">$strf </font><font color="#007700">= </font><font color="#0000BB">strftime</font><font color="#007700">(</font><font color="#0000BB">$format</font><font color="#007700">);<br /><br />echo </font><font color="#DD0000">"$strf</font><font color="#007700">\n</font><font color="#DD0000">"</font><font color="#007700">;<br /><br /></font><font color="#0000BB">print_r</font><font color="#007700">(</font><font color="#0000BB">strptime</font><font color="#007700">(</font><font color="#0000BB">$strf</font><font color="#007700">, </font><font color="#0000BB">$format</font><font color="#007700">));<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P >O exemplo acima irá imprimir algo similar a:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >03/10/2004 15:54:19 Array ( [tm_sec] => 19 [tm_min] => 54 [tm_hour] => 15 [tm_mday] => 3 [tm_mon] => 9 [tm_year] => 104 [tm_wday] => 0 [tm_yday] => 276 [unparsed] => )</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN27225" ></A ><H2 >Veja também</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.strftime.html" ><B CLASS="function" >strftime()</B ></A ></TD ></TR ></TBODY ></TABLE ><P ></P > </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="function.strftime.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="function.strtotime.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >strftime</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.datetime.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >strtotime</TD ></TR ></TABLE ></DIV ></BODY ></HTML >