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

Unit 8: Working with Strings, Date and Time



                  Internet time   B                    The swath Internet time in which           Notes
                                                       a day is
                                                       divided into 1,000 units:

                                                       <? php

                                                       echo date (‘B’). “\n”//shows
                                                       → 00s
                                                       ?>
                  ISO 8601        c                    Shows the date in ISO 8601 format:
                                                       2004-03-01Too: 08:37+01:00
                  Leap Year       L                    Returns 1 if the year represented
                                                       by the timestamp is a leap year,
                                                       or 0 otherwise.
                  Minutes, leading  1      %M
                  Zeroes
                  Month, full textual p    %B          For (gm) strftime (), the month
                                                       name is the name in the language
                                                       of the current locale.

                                                       <?php

                                                       set locale (LC_ALL, ‘1w_IL’)’
                                                       echo strftime 9”%B\n”);//
                                                       shows

                                                       ?>
                  Month, numeric  M        %m
                  with leading zeroes
                  Month, numeric  N
                  without leading
                  zeroes
                  Month, short    M        %b, %h
                  textual
                  RFC 2822        R                    Returns a RFC 2822 (mail)
                                                       formatted text (Mon, 1 Mar,
                                                       2004 00:13:34 + 0100).
                  Seconds since   U
                  UNIX epoch
                  Seconds, numberic  s     %S
                  with leading zeroes
                  Suffix  for  day  of  S              Returns an English ordinal suffix
                  month, English                       for  use  with  the  J  formatting
                  ordinal                              option.

                                                       <?php
                                                       echo date (“js\n”); // returns
                                                       → 1st

                                                       ?>
                                                                                Contd...
                                             LOVELY PROFESSIONAL UNIVERSITY                                   131
   131   132   133   134   135   136   137   138   139   140   141