1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 2017/5/25
- * Time: 上午10:21
- */
- class TestTime extends PHPUnit_Framework_TestCase
- {
- public function testDay()
- {
- $date = date('Y-m-d',time());
- $this->mStartm = strtotime(date('Y-m-d',time()));
- $this->mEndtm = $this->mStartm + 86400 - 1;
- }
- public function testWeek()
- {
- $date = date('Y-m-d',time());
- $cur_time = strtotime(date('Y-m-d',time())) + 86400;
- $start = $cur_time - 86400 * 7;
- $end = $cur_time -1;
- $v = ($end - $start + 1) / 86400;
- }
- public function testMonth()
- {
- $cur = time();
- $cur_date = new DateTime();
- $cur_date->setTimestamp($cur);
- $inter = new DateInterval('P1M');
- $cur_date->sub($inter);
- $time = $cur_date->getTimestamp();
- }
- }
|