The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

Loop through dates

  • # March 9, 2013 at 5:30 am

    I’d like to make a _selection list of dates_ that a user could choose from. The date should start by the **Current date today** and ends **5 days after**. I just don’t know how to execute it inside a loop so I wouldn’t change the date over and over again. Thanks. Please help. ;(

    # March 9, 2013 at 7:19 am

    $date = new DateTime(); // Without argument: now
    $interval = new Dateinterval(“P1D”); // Period: 1 day
    for ($i = 0; $i < = 5; $i++) {
    echo $date->format(“Y-m-d”).”n”;

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed