gables20
gables20

Reputation: 496

stuck with phptime function

What i am trying to achive is return something like this.

day1 day2 day3 ... day7 Today, as in today's date should be equal to day1, tomorrow, should be equal to day 2 and the same applies until day7.

What i have written so far is this but i am stuck and not sure how to proceed.

function future_date (){ 
    $numDays=7; 
    for($i=0; $i<$numDays; $i++) { 
        $futuredate = date('d-m-Y', strtotime('+' . strval($i) . ' days'));
        print $futuredate;
        return $futuredate;
     }
}

Upvotes: 0

Views: 43

Answers (1)

Stephen
Stephen

Reputation: 18964

If I gather your requirements based on your comment, you just need to format the date differently. That means you need to change the 'd-m-Y' string. Take a look at date().

The day of the week can be represented by a lowercase L date('l').

Upvotes: 1

Related Questions