如何从受保护的数组中获取日期值?

时间:2014-11-07 13:04:27

标签: php arrays date amazon-mws

我从亚马逊的Report API获取此输出,我正在尝试获取AvailableDate字段值,但它一直告诉我。

Amazon API的输出:

MarketplaceWebService_Model_ReportInfo Object
(
    [fields:protected] => Array
        (
            [ReportId] => Array
                (
                    [FieldValue] => 11111111111
                    [FieldType] => string
                )

            [ReportType] => Array
                (
                    [FieldValue] => _GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA_
                    [FieldType] => string
                )
            [ReportRequestId] => Array
                (
                    [FieldValue] => 11111111111
                    [FieldType] => string
                )
            [AvailableDate] => Array
                (
                    [FieldValue] => DateTime Object
                        (
                            [date] => 2014-11-07 11:50:58
                            [timezone_type] => 1
                            [timezone] => +00:00
                        )
                    [FieldType] => DateTime
                )
            [Acknowledged] => Array
                (
                    [FieldValue] => 
                    [FieldType] => bool
                )
            [AcknowledgedDate] => Array
                (
                    [FieldValue] => 
                    [FieldType] => DateTime
                )
        )
)

我正在尝试这段代码:

$sdate = new DateTime($available_date);

请帮忙......

1 个答案:

答案 0 :(得分:1)

尝试使用公开getAvailableDate()方法。

<?
$marketPlaceReport = new MarketplaceWebService_Model_ReportInfo();

$sdate = $marketPlaceReport->getAvailableDate();
?>