Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts

    GMT date, with AM/PM

    hi guys, how would i make this GMT time/date work by displaying AM or PM, i know its a very novice question, but is it possible?
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,509
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    Bookmark this page: http://php.net/manual/en/function.date.php
    You'll use that all the time.

    quote ...
    "... make this GMT time/date ..."

    What is "this"? You're not showing us anything.

  • #3
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by mlseim View Post
    Bookmark this page: http://php.net/manual/en/function.date.php
    You'll use that all the time.

    quote ...
    "... make this GMT time/date ..."

    What is "this"? You're not showing us anything.

    sorry, i forgot to past in what i had

    <?php $date = gmdate('h:i:s'); echo "$date"; ?>
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,509
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    <?php $date = gmdate('g:i:s A'); echo "$date"; ?>

    g or h .. depending on leading zero.

    Also know that you can force the server to
    use whatever timezone you wish. Otherwise,
    the calculations of date and time are based
    off of your server. That might be important
    for daylight savings time, as some cities in
    the world don't honor DST.



    .
    Last edited by mlseim; 02-01-2012 at 10:52 PM.

  • #5
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by mlseim View Post
    <?php $date = gmdate('g:i:s A'); echo "$date"; ?>

    g or h .. depending on leading zero.
    Thanks, just as you was writing that, i was uploading what I had worked out from the link you gave me, we got exactly the same apart from i used the h instead of g.

    Thanks
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags


  •  

    Posting Permissions

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