TestTime.php 862 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 2017/5/25
  6. * Time: 上午10:21
  7. */
  8. class TestTime extends PHPUnit_Framework_TestCase
  9. {
  10. public function testDay()
  11. {
  12. $date = date('Y-m-d',time());
  13. $this->mStartm = strtotime(date('Y-m-d',time()));
  14. $this->mEndtm = $this->mStartm + 86400 - 1;
  15. }
  16. public function testWeek()
  17. {
  18. $date = date('Y-m-d',time());
  19. $cur_time = strtotime(date('Y-m-d',time())) + 86400;
  20. $start = $cur_time - 86400 * 7;
  21. $end = $cur_time -1;
  22. $v = ($end - $start + 1) / 86400;
  23. }
  24. public function testMonth()
  25. {
  26. $cur = time();
  27. $cur_date = new DateTime();
  28. $cur_date->setTimestamp($cur);
  29. $inter = new DateInterval('P1M');
  30. $cur_date->sub($inter);
  31. $time = $cur_date->getTimestamp();
  32. }
  33. }