TestTime.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 testS()
  11. {
  12. $tm = strtotime('2017-08-01 3:43:00');
  13. $tm1 = strtotime('2017-8-01 3:43:00');
  14. $tm2 = strtotime('2017-08-1 3:43:00');
  15. $tm3 = strtotime('2017-8-1 3:43:00');
  16. $tm3 = strtotime('2017-8-1 03:43:00');
  17. $tm3 = strtotime('2017-8-1 3:43:00');
  18. $tm3 = strtotime('2017-8-1 3:43');
  19. }
  20. public function testDay()
  21. {
  22. $date = date('Y-m-d',time());
  23. $this->mStartm = strtotime(date('Y-m-d',time()));
  24. $this->mEndtm = $this->mStartm + 86400 - 1;
  25. }
  26. public function testWeek()
  27. {
  28. $date = date('Y-m-d',time());
  29. $cur_time = strtotime(date('Y-m-d',time())) + 86400;
  30. $start = $cur_time - 86400 * 7;
  31. $end = $cur_time -1;
  32. $v = ($end - $start + 1) / 86400;
  33. }
  34. public function testMonth()
  35. {
  36. $cur = time();
  37. $cur_date = new DateTime();
  38. $cur_date->setTimestamp($cur);
  39. $inter = new DateInterval('P1M');
  40. $cur_date->sub($inter);
  41. $time = $cur_date->getTimestamp();
  42. }
  43. }