IXR_Date

IXR_Date.

Defined (1)

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

/bp-forums/bbpress/bb-includes/backpress/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. function __construct($time) 
  11. // $time can be a PHP timestamp or an ISO one 
  12. if (is_numeric($time)) { 
  13. $this->parseTimestamp($time); 
  14. } else { 
  15. $this->parseIso($time); 
  16.  
  17. function IXR_Date($time) 
  18. $this->__construct($time); 
  19.  
  20. function parseTimestamp($timestamp) 
  21. $this->year = date('Y', $timestamp); 
  22. $this->month = date('m', $timestamp); 
  23. $this->day = date('d', $timestamp); 
  24. $this->hour = date('H', $timestamp); 
  25. $this->minute = date('i', $timestamp); 
  26. $this->second = date('s', $timestamp); 
  27. $this->timezone = ''; 
  28.  
  29. function parseIso($iso) 
  30. $this->year = substr($iso, 0, 4); 
  31. $this->month = substr($iso, 4, 2); 
  32. $this->day = substr($iso, 6, 2); 
  33. $this->hour = substr($iso, 9, 2); 
  34. $this->minute = substr($iso, 12, 2); 
  35. $this->second = substr($iso, 15, 2); 
  36. $this->timezone = substr($iso, 17); 
  37.  
  38. function getIso() 
  39. return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone; 
  40.  
  41. function getXml() 
  42. return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>'; 
  43.  
  44. function getTimestamp() 
  45. return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);