logo       

cvs: phpdoc /en/reference/datetime/functions strftime.xml: msg#00476

Subject: cvs: phpdoc /en/reference/datetime/functions strftime.xml
pollita         Tue Dec 31 14:18:14 2002 EDT

  Modified files:              
    /phpdoc/en/reference/datetime/functions     strftime.xml 
  Log:
  Per multiple "bug" reports of misunderstanding use of %G and %V, added 
example showing week numbers for 2002/2003 (week forward) and 2004/2005 (week 
backward).
  
  
Index: phpdoc/en/reference/datetime/functions/strftime.xml
diff -u phpdoc/en/reference/datetime/functions/strftime.xml:1.4 
phpdoc/en/reference/datetime/functions/strftime.xml:1.5
--- phpdoc/en/reference/datetime/functions/strftime.xml:1.4     Tue Nov 26 
15:41:08 2002
+++ phpdoc/en/reference/datetime/functions/strftime.xml Tue Dec 31 14:18:14 2002
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
 <!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
   <refentry id="function.strftime">
    <refnamediv>
@@ -242,7 +242,7 @@
       </para>
      </note>
      <example>
-      <title><function>strftime</function> example</title>
+      <title><function>strftime</function> locale examples</title>
       <programlisting role="php">
 <![CDATA[
 setlocale (LC_TIME, "C");
@@ -258,6 +258,66 @@
      </example>
      This example works if you have the respective locales installed
      in your system.
+     <note>
+      <simpara>
+       %G and %V, which are based on ISO 8601:1988 week numbers can
+       give unexpected (albiet correct) results if the numbering system 
+       is not thoroughly understood.  See %V above and example below.
+      </simpara>
+     </note>
+     <example>
+      <title>ISO 8601:1988 week number example</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+/*     December 2002 / January 2003
+ISOWk  M   Tu  W   Thu F   Sa  Su
+----- ----------------------------
+51     16  17  18  19  20  21  22 
+52     23  24  25  26  27  28  29
+1      30  31   1   2   3   4   5
+2       6   7   8   9  10  11  12
+3      13  14  15  16  17  18  19   */
+
+// Outputs: 12/28/2002 - %V,%G,%Y = 52,2002,2002
+print "12/28/2002 - %V,%G,%Y = " . 
strftime("%V,%G,%Y",strtotime("12/28/2002")) . "\n";
+
+// Outputs: 12/30/2002 - %V,%G,%Y = 1,2003,2002
+print "12/30/2002 - %V,%G,%Y = " . 
strftime("%V,%G,%Y",strtotime("12/30/2002")) . "\n";
+
+// Outputs: 1/3/2003 - %V,%G,%Y = 1,2003,2003
+print "1/3/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2003")) . 
"\n";
+
+// Outputs: 1/10/2003 - %V,%G,%Y = 2,2003,2003
+print "1/10/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/10/2003")) 
. "\n";
+
+
+
+/*     December 2004 / January 2005
+ISOWk  M   Tu  W   Thu F   Sa  Su
+----- ----------------------------
+51     13  14  15  16  17  18  19
+52     20  21  22  23  24  25  26
+53     27  28  29  30  31   1   2
+1       3   4   5   6   7   8   9
+2      10  11  12  13  14  15  16   */
+
+// Outputs: 12/23/2004 - %V,%G,%Y = 52,2004,2004
+print "12/23/2004 - %V,%G,%Y = " . 
strftime("%V,%G,%Y",strtotime("12/23/2004")) . "\n";
+
+// Outputs: 12/31/2004 - %V,%G,%Y = 53,2004,2004
+print "12/31/2004 - %V,%G,%Y = " . 
strftime("%V,%G,%Y",strtotime("12/31/2004")) . "\n";
+
+// Outputs: 1/2/2005 - %V,%G,%Y = 53,2004,2005
+print "1/2/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/2/2005")) . 
"\n";
+
+// Outputs: 1/3/2005 - %V,%G,%Y = 1,2005,2005
+print "1/3/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2005")) . 
"\n";
+
+?>
+]]>
+      </programlisting>
+     </example>
     </para>
     <para>
      See also <function>setlocale</function> and



-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe