function xmlrpc_date
xmlrpc_date($time)
Converts a PHP or ISO date/time to an XML-RPC object.
Parameters
$time: A PHP timestamp or an ISO date-time string.
Return value
object An XML-RPC time/date object.
File
- includes/xmlrpc.inc, line 492
- Drupal XML-RPC library.
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 = gmdate('Y', $time); $xmlrpc_date->month = gmdate('m', $time); $xmlrpc_date->day = gmdate('d', $time); $xmlrpc_date->hour = gmdate('H', $time); $xmlrpc_date->minute = gmdate('i', $time); $xmlrpc_date->second = gmdate('s', $time); $xmlrpc_date->iso8601 = gmdate('Ymd\TH:i:s', $time); } else { $xmlrpc_date->iso8601 = $time; $time = str_replace(array('-', ':'), '', $time); $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, 11, 2); $xmlrpc_date->second = substr($time, 13, 2); } return $xmlrpc_date; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!xmlrpc.inc/function/xmlrpc_date/7.x