You are here

private static function Braintree_Xml_Parser::_timestampToUTC in Commerce Braintree 7

convert xml timestamps into DateTime

Parameters

string $timestamp:

Return value

string UTC formatted datetime string

1 call to Braintree_Xml_Parser::_timestampToUTC()
Braintree_Xml_Parser::_typecastXmlValue in braintree_php/lib/Braintree/Xml/Parser.php
typecast xml value based on attributes

File

braintree_php/lib/Braintree/Xml/Parser.php, line 170

Class

Braintree_Xml_Parser
Parses incoming Xml into arrays using PHP's built-in SimpleXML, and its extension via Iterator, SimpleXMLIterator

Code

private static function _timestampToUTC($timestamp) {
  $tz = new DateTimeZone('UTC');

  // strangely DateTime requires an explicit set below
  // to show the proper time zone
  $dateTime = new DateTime($timestamp, $tz);
  $dateTime
    ->setTimezone($tz);
  return $dateTime;
}