NXS_XMLRPC_Date

NXS_XMLRPC_Date.

Defined (1)

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

/inc-cl/apis/xmlrpc-client.php  
  1. class NXS_XMLRPC_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 NXS_XMLRPC_Date($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 parseTimestamp($timestamp) 
  18. $this->year = date('Y', $timestamp); 
  19. $this->month = date('m', $timestamp); 
  20. $this->day = date('d', $timestamp); 
  21. $this->hour = date('H', $timestamp); 
  22. $this->minute = date('i', $timestamp); 
  23. $this->second = date('s', $timestamp); 
  24. $this->timezone = ''; 
  25.  
  26. function parseIso($iso) 
  27. $this->year = substr($iso, 0, 4); 
  28. $this->month = substr($iso, 4, 2); 
  29. $this->day = substr($iso, 6, 2); 
  30. $this->hour = substr($iso, 9, 2); 
  31. $this->minute = substr($iso, 12, 2); 
  32. $this->second = substr($iso, 15, 2); 
  33. $this->timezone = substr($iso, 17); 
  34.  
  35. function getIso() 
  36. return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone; 
  37.  
  38. function getXml() 
  39. return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>'; 
  40.  
  41. function getTimestamp() 
  42. return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);