开发者

stuck with phptime function

开发者 https://www.devze.com 2023-02-28 21:16 出处:网络
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 da

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开发者_StackOverflow社区=0; $i<$numDays; $i++) { 
        $futuredate = date('d-m-Y', strtotime('+' . strval($i) . ' days'));
        print $futuredate;
        return $futuredate;
     }
}


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').

0

精彩评论

暂无评论...
验证码 换一张
取 消