SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Date and time in php ?

    Hi all, anyone know how to set the dates and times in PHP please ? Through some work and researching I've made the code below, but it doesn't automatically change for daylight saving ? Also, does anyone know of a way to get the seconds to be changing while on the page please ? (Dynamic ?)

    <?php
    date_default_timezone_set('GMT');
    #echo date("l, \\t\h\e jS of F, Y, H:i:s a");
    echo date("l, \\t\h\e jS \of F, Y, H:i:s a");
    ?>

    Any help appreciated.

    Dez.

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    PHP has no control over the page content once it has been sent to the browser, if you need the content to change post dispatch you'll need to be looking for a JavaScript solution.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Aaah, yep, good point. Perhaps I'll pop over to the js section. Unless anyone knows the answer here ?

    Dez.

  4. #4
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,398
    Mentioned
    65 Post(s)
    Tagged
    1 Thread(s)
    GMT doesn't have daylight savings. Try a relevant location-based timezone string instead, e.g. Europe/London.
    Salathe
    Software Developer and PHP Manual Author.

  5. #5
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Salathe View Post
    GMT doesn't have daylight savings. Try a relevant location-based timezone string instead, e.g. Europe/London.
    ok, many thanks -back to the drawing board !


Bookmarks

Posting Permissions

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