Results 1 to 3 of 3

Thread: PHP Countdown only changing in the afternoon and not midnight

  1. #1
    Join Date
    Feb 2007
    Location
    West Yorkshire, United Kingdom
    Posts
    145
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Post PHP Countdown only changing in the afternoon and not midnight

    Hi, my PHP countdown script counts down the number of days until a custom date, i have a problem though the number of days in the countdown only change after 12:00 in the afternoon, instead i want it to change at 12:00 midnight. Is it possible to do this?

    Here is the code:
    PHP Code:
    <?php
    // set the default timezone to use. Available since PHP 5.1
    date_default_timezone_set('GMT');

    $custom_date strtotime('15 February 2009');
    $now time();
    $timeleft $custom_date-$now;
    $daysleft round((($timeleft/24)/60)/60); //probably...
    echo "$daysleft days until New York trip";
    ?>
    Last edited by Ryan Fitton; 02-07-2009 at 08:53 PM.

  2. #2
    Join Date
    Jul 2008
    Posts
    199
    Thanks
    6
    Thanked 58 Times in 57 Posts

    Default

    Instead of the round function, use the floor function.

  3. The Following User Says Thank You to techietim For This Useful Post:

    Ryan Fitton (02-08-2009)

  4. #3
    Join Date
    Feb 2007
    Location
    West Yorkshire, United Kingdom
    Posts
    145
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    Thanks techietim, it work great now

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
  •