You are here

function xmlrpc_date in Drupal 4

Same name and namespace in other branches
  1. 5 includes/xmlrpc.inc \xmlrpc_date()
  2. 6 includes/xmlrpc.inc \xmlrpc_date()
  3. 7 includes/xmlrpc.inc \xmlrpc_date()
2 calls to xmlrpc_date()
xmlrpc_message_tag_close in includes/xmlrpc.inc
_blogapi_get_post in modules/blogapi.module

File

includes/xmlrpc.inc, line 378

Code

function xmlrpc_date($time) {
  $xmlrpc_date = new stdClass();
  $xmlrpc_date->is_date = TRUE;

  // $time can be a PHP timestamp or an ISO one
  if (is_numeric($time)) {
    $xmlrpc_date->year = date('Y', $time);
    $xmlrpc_date->month = date('m', $time);
    $xmlrpc_date->day = date('d', $time);
    $xmlrpc_date->hour = date('H', $time);
    $xmlrpc_date->minute = date('i', $time);
    $xmlrpc_date->second = date('s', $time);
    $xmlrpc_date->iso8601 = date('Ymd\\TH:i:s');
  }
  else {
    $xmlrpc_date->year = substr($time, 0, 4);
    $xmlrpc_date->month = substr($time, 4, 2);
    $xmlrpc_date->day = substr($time, 6, 2);
    $xmlrpc_date->hour = substr($time, 9, 2);
    $xmlrpc_date->minute = substr($time, 12, 2);
    $xmlrpc_date->second = substr($time, 15, 2);
    $xmlrpc_date->iso8601 = $time;
  }
  return $xmlrpc_date;
}