You are here

private static function Braintree_Xml_Generator::_castDateTime in Commerce Braintree 7

File

braintree_php/lib/Braintree/Xml/Generator.php, line 131

Class

Braintree_Xml_Generator
Generates XML output from arrays using PHP's built-in XMLWriter

Code

private static function _castDateTime($string) {
  try {
    if (empty($string)) {
      return false;
    }
    $dateTime = new DateTime($string);
    return self::_dateTimeToXmlTimestamp($dateTime);
  } catch (Exception $e) {

    // not a datetime
    return false;
  }
}