Page 137 - Open Soource Technologies 304.indd
P. 137

Open Source Technologies



                   Notes
                                       Time zone,       Z                    Returns the offest to GMT in
                                       numeric (in                           seconds.  For  CET,  this  is  3600;
                                       seconds)                              for EST, this is –18000,
                                                                             seconds) for example.
                                       Time zone,       O                    Returns a formatted offset to
                                       numeric                               GMT. For GET, this is +0100; for
                                       formatted                             EST, this is –0500, for example.
                                       Time zone, textual T      %Z          Returns the current time zone
                                                                             name: CET, EST, and so on.
                                       Week number, ISO  W       %V           In ISO 8601, week # 1 is the first
                                       8601                                  week in the year having four
                                                                             or more days. The range is 01
                                                                             to  53, and you can use this in
                                                                             combination with %g or %G for
                                                                             the accompanying year:
                                       Week number, the          %W          <? php
                                       first  Monday  in  a                  // shows 01
                                       year is the start of
                                       week 1                                echo strftime (“%w”’
                                                                             strtot1me (“2001-01-0-
                                                                             → 01”)), “\m”,
                                                                             // shows 53
                                                                             echo strft1me (“%W”,
                                                                             strtot1me (“2005-12
                                                                             → 31”)),”\n”,
                                                                             ?>
                                       Week number, the          %U          <? php
                                       first Sunday in a
                                       year is the start of                  // shows 00
                                       week 1                                echo strftime (“%U”,

                                                                             strtotime (“2001-01-)
                                                                             01”)), “\n”;

                                                                             // shows 52
                                                                             echo strftime (“%U”,
                                                                             strtotime (“2001-12-

                                                                             31”)).”\n”;
                                                                             ?>
                                       Year, numeric two  Y      %Y
                                       digits with
                                       Year, numeric             %g          This number might differ from
                                       two digits; year                      the  “real  year”,  as  in  ISO  8601;
                                       component for                         January 1 might still belong to
                                       %w                                    week 53 of the year before. In that
                                                                             case, the year returned with this
                                                                             formatting option will be the one
                                                                             of the previous year, too.

                                                                                                      Contd...
        132                               LOVELY PROFESSIONAL UNIVERSITY
   132   133   134   135   136   137   138   139   140   141   142