mytime.init.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. class mytimeInit{
  3. private $year;
  4. private $mouth;
  5. private $date;
  6. private $hour;
  7. private $minute;
  8. private $microtime;
  9. private $logtime;
  10. private $Time;
  11. public function __construct($read_time = null) {
  12. if($read_time){
  13. $strtime=strtotime($read_time);
  14. $to_time=$strtime-600;
  15. }else{
  16. $log_time=time()-300;
  17. $this->explode_time($log_time);
  18. $this->set_logtime();
  19. $to_time=time()-900;
  20. }
  21. $this->explode_time($to_time);
  22. }
  23. public function explode_time($to_time){
  24. $this->Time=date("Y-m-d-H-i",$to_time);
  25. $to_time_array=explode("-", $this->Time);
  26. $this->year=$to_time_array[0];
  27. $this->mouth=$to_time_array[1];
  28. $this->date=$to_time_array[2];
  29. $this->hour=$to_time_array[3];
  30. $this->minute=$to_time_array[4];
  31. $this->minute=$this->minute{0}.'0';
  32. $this->microtime=mktime(0, 0, 0, $this->mouth, $this->date,$this->year);
  33. }
  34. public function get_microtime(){
  35. return $this->microtime;
  36. }
  37. public function get_Time(){
  38. return $this->Time;
  39. }
  40. public function set_logtime(){
  41. $this->logtime=$this->year.$this->mouth.$this->date.$this->hour.$this->minute;
  42. }
  43. public function get_logtime(){
  44. return $this->logtime;
  45. }
  46. public function get_tablename(){
  47. $tablename=$this->year.$this->mouth;
  48. return $tablename;
  49. }
  50. public function get_thedate(){
  51. $Thedate =$this->year.'-'.$this->mouth.'-'.$this->date;
  52. return $Thedate;
  53. }
  54. public function get_thehours(){
  55. return $this->hour;
  56. }
  57. public function get_date(){
  58. return $this->date;
  59. }
  60. public function get_minute(){
  61. return $this->minute;
  62. }
  63. }
  64. ?>