svn: /phpdoc/en/trunk/reference/datetime/functions/ strtotime.xml

From: Date: Tue, 09 Nov 2010 10:53:51 +0000
Subject: svn: /phpdoc/en/trunk/reference/datetime/functions/ strtotime.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-7398@lists.php.net to get a copy of this message
aharvey Tue, 09 Nov 2010 10:53:51 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=305220 Log: Removed the reference to "US English" in the strtotime() description, since that's not true for all delimiters, and added an explanatory note summarising the Date and Time Formats grammar and how it pertains to m/d/y and d-m-y, along with a recommendation to use ISO 8601 or DateTime::createFromFormat() where possible. Changed paths: U phpdoc/en/trunk/reference/datetime/functions/strtotime.xml Modified: phpdoc/en/trunk/reference/datetime/functions/strtotime.xml =================================================================== --- phpdoc/en/trunk/reference/datetime/functions/strtotime.xml 2010-11-09 10:49:01 UTC (rev 305219) +++ phpdoc/en/trunk/reference/datetime/functions/strtotime.xml 2010-11-09 10:53:51 UTC (rev 305220) @@ -14,11 +14,11 @@ <methodparam choice="opt"><type>int</type><parameter>now</parameter></methodparam> </methodsynopsis> <simpara> - The function expects to be given a string containing a US English date - format and will try to parse that format into a Unix timestamp (the - number of seconds since January 1 1970 00:00:00 UTC), relative - to the timestamp given in <parameter>now</parameter>, or the current time - if <parameter>now</parameter> is not supplied. + The function expects to be given a string containing an English date format + and will try to parse that format into a Unix timestamp (the number of + seconds since January 1 1970 00:00:00 UTC), relative to the timestamp given + in <parameter>now</parameter>, or the current time if + <parameter>now</parameter> is not supplied. </simpara> <para> This function will use the <envar>TZ</envar> environment variable (if @@ -199,12 +199,28 @@ newer versions overcome this limitation though. </para> </note> + <note> + <para> + Dates in the <literal>m/d/y</literal> or <literal>d-m-y</literal> formats + are disambiguated by looking at the separator between the various + components: if the separator is a slash (<literal>/</literal>), then the + American <literal>m/d/y</literal> is assumed; whereas if the separator is a + dash (<literal>-</literal>) or a dot (<literal>.</literal>), then the + European <literal>d-m-y</literal> format is assumed. + </para> + <para> + To avoid potential ambiguity, it's best to use ISO 8601 + (<literal>YYYY-MM-DD</literal>) dates or + <function>DateTime::createFromFormat</function> when possible. + </para> + </note> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> + <member><function>DateTime::createFromFormat</function></member> <member><function>strptime</function></member> </simplelist> </para>

« previous php.doc.cvs (#7398) next »