www.webdeveloper.com
Results 1 to 2 of 2

Thread: GMT Date and Time Print PHP Modification

  1. #1
    Join Date
    Dec 2002
    Posts
    159

    GMT Date and Time Print PHP Modification

    Hello there,

    Can someone please let me know how I modify this...

    <?php
    date_default_timezone_set('Europe/London');
    echo date('l jS F Y, h:i A e', time());
    ?>

    to show...

    Wednesday 23rd April 2014, 10:52 AM London GMT

    instead of...

    Wednesday 23rd April 2014, 10:52 AM Europe/London

    Thank you for any assistance provided.

  2. #2
    Join Date
    Mar 2005
    Location
    Behind you...
    Posts
    862
    You could just use:
    PHP Code:
    <?php
      date_default_timezone_set
    ('Europe/London');
      echo 
    date('l jS F Y, h:i A'time()) . " London GMT";
    ?>
    The 'e' in the date() function displays the timezone identifier, which is 'Europe/London'. As far as I know there is not a timezone identifier in PHP that is 'London GMT', thus the date() function can't actually return that part of the string you want. Thus it's easier to just add it to the end as an actual string as demonstrated above.
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles