I get the following object in response to a call in PHP:
Transaction[id=g855fm, type=sale, amount=100.00, status=processed, createdAt=Tuesday, 24-Jun-14 19:17:58 UTC]
I am able to echo id
, amount
, status
etc. but createdAt
does not print. Perhaps because it has a comma (,) in it? I want to convert the sate from string format to mm/dd/yyyy but I can not format it to mm/dd/yyyy because I am not able to get createdAt.
echo $object->createdAt;
prints nothing.
echo $object->id;
prints g855fm
.
echo $object->status;
prints processed
.
This is the whole object:
Braintree_Subscription[
addOns=,
balance=0.00,
billingDayOfMonth=24,
billingPeriodEndDate=Wednesday, 23-Jul-14 00:00:00 MDT,
billingPeriodStartDate=Tuesday, 24-Jun-14 00:00:00 MDT,
currentBillingCycle=1,
daysPastDue=,
discounts=,
failureCount=0,
firstBillingDate=Tuesday, 24-Jun-14 00:00:00 MDT,
id=6q6qg2,
merchantAccountId=XXXX,
neverExpires=1,
nextBillAmount=100.00,
nextBillingPeriodAmount=100.00,
nextBillingDate=Thursday, 24-Jul-14 00:00:00 MDT,
numberOfBillingCycles=,
paidThroughDate=Wednesday, 23-Jul-14 00:00:00 MDT,
paymentMethodToken=3mzhf6,
planId=XXXX,
price=100.00,
status=Active,
trialDuration=,
trialDurationUnit=day,
trialPeriod=,
descriptor=Braintree_Descriptor[
name=, phone=
],
transactions=
0=Braintree_Transaction[
id=h2v7qm,
type=sale,
amount=100.00,
status=submitted_for_settlement,
createdAt=Wednesday, 25-Jun-14 03:53:07 UTC,
creditCardDetails=Braintree_Transaction_CreditCardDetails[
token=3mzhf6,
bin=411111,
last4=1111,
cardType=Visa,
expirationMonth=06,
expirationYear=2014,
customerLocation=US,
cardholderName=,
imageUrl=https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=sandbox&merchant_id=XXXX,
prepaid=Unknown,
healthcare=Unknown,
debit=Unknown,
durbinRegulated=Unknown,
commercial=Unknown,
payroll=Unknown,
issuingBank=Unknown,
countryOfIssuance=Unknown,
productId=Unknown,
venmoSdk=,
expirationDate=06/2014,
maskedNumber=411111******1111
],
customerDetails=Braintree_Transaction_CustomerDetails[
id=59273593,
firstName=XXXX,
lastName=,
company=,
email=XXXX,
website=,
phone=XXXX,
fax=
]
]
]
I am accessing it like: $object->transactions[0]->createdAt
Update:
echo $object->transactions[0]->createdAt->format('r');
is: Wed, 25 Jun 2014 04:07:42 +0000
I will now try to use it now for date formatting. I want it in date(dd/mm/yyyy)
format. Any idea how to do that?