SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2012
    Location
    Poole, Dorset, United Kingdom
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    End Of British Summer Time Showing Twice On Calendar

    Hi All
    I've written a simple calendar that shows the next 7 days from todays date.
    Works find except this Sunday is shown twice, I'm guessing its because British Summer Time is over.
    How can I check for this and correct the error


    for($i =0; $i<7; $i++)
    {
    $time = 86400 * $i;
    $newTime = $todayNow + $time;

    $dateDay = date('D', $newTime) ;
    $dateNum = date('j', $newTime) ;
    $dateMonth = date('M', $newTime) ;

    echo("<td bgcolor='#F6851F' span class='create_slots_header' align='center'>$dateDay $dateNum $dateMonth</span></td>");
    // grab day and match with timeslot details for start and finish time
    }

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    Use relative dates instead.
    PHP Code:
    for($i 0$i 7$i++) {
     echo(
    "<td bgcolor='#F6851F' span class='create_slots_header' align='center'>".date('D j M',strtotime("+".$i." days"))."</span></td>");

    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  3. #3
    SitePoint Addict kduv's Avatar
    Join Date
    May 2012
    Location
    Maui, HI
    Posts
    211
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    You may also want to check out the DateTime class in PHP.
    Keith
    Freelance web developer
    http://www.duvalltech.com/


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
  •