IXR_Date

IXR_Date.

Defined (1)

The class is defined in the following location(s).

/wp-includes/class-IXR.php  
  1. class IXR_Date { 
  2. var $year; 
  3. var $month; 
  4. var $day; 
  5. var $hour; 
  6. var $minute; 
  7. var $second; 
  8. var $timezone; 
  9.  
  10. /** 
  11. * PHP5 constructor. 
  12. */ 
  13. function __construct( $time ) 
  14. // $time can be a PHP timestamp or an ISO one 
  15. if (is_numeric($time)) { 
  16. $this->parseTimestamp($time); 
  17. } else { 
  18. $this->parseIso($time); 
  19.  
  20. /** 
  21. * PHP4 constructor. 
  22. */ 
  23. public function IXR_Date( $time ) { 
  24. self::__construct( $time ); 
  25.  
  26. function parseTimestamp($timestamp) 
  27. $this->year = date('Y', $timestamp); 
  28. $this->month = date('m', $timestamp); 
  29. $this->day = date('d', $timestamp); 
  30. $this->hour = date('H', $timestamp); 
  31. $this->minute = date('i', $timestamp); 
  32. $this->second = date('s', $timestamp); 
  33. $this->timezone = ''; 
  34.  
  35. function parseIso($iso) 
  36. $this->year = substr($iso, 0, 4); 
  37. $this->month = substr($iso, 4, 2); 
  38. $this->day = substr($iso, 6, 2); 
  39. $this->hour = substr($iso, 9, 2); 
  40. $this->minute = substr($iso, 12, 2); 
  41. $this->second = substr($iso, 15, 2); 
  42. $this->timezone = substr($iso, 17); 
  43.  
  44. function getIso() 
  45. return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone; 
  46.  
  47. function getXml() 
  48. return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>'; 
  49.  
  50. function getTimestamp() 
  51. return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);