开发者

Get a list of this week dates [duplicate]

开发者 https://www.devze.com 2023-03-04 16:29 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: how to find the dates between two dates specified
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

how to find the dates between two dates specified

I want to get todays date and the following 6 days. I wish to display it as an html list. So say today date is the 1st October I would like to ret开发者_运维问答urn.

<ul>
        <li>01/10/2011</li>
        <li>02/10/2011</li>
        <li>03/10/2011</li>
        <li>04/10/2011</li>
        <li>05/10/2011</li>
        <li>06/10/2011</li>
        <li>07/10/2011</li>
</ul>


From the PHP Documentation:

It is possible to use date() and mktime() together to find dates in the future or the past.

<?php
$tomorrow  = mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"));
$lastmonth = mktime(0, 0, 0, date("m")-1, date("d"),   date("Y"));
$nextyear  = mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+1);
?>

See here.

0

精彩评论

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