| 5:25 pm on Jul 28, 2012 (gmt 0)|
Is it not simply
From there it depends on what your needs are. You could truncate the string to 10 characters or you could do a double convert to get any format you want, using strtotime() to get a UNIX timestamp and then using the date() function to reformat.
You have a MySQL format date/time, so that's valid to use with strtotime() as is. So you just have
$formatted_date = date('l jS \of F Y', strtotime($transaction->subscriptionDetails->_attributes['billingPeriodEndDate']->date));
to print a date like "Saturday, 27th of July, 2012" should you be so moved.
date/time formats: [php.net...]
| 10:03 pm on Jul 28, 2012 (gmt 0)|
Thanks very much for your help. But that didn't work for me. Below is the error.
|Catchable fatal error: Object of class DateTime could not be converted to string in /var/www/html/wp-content/themes/#*$!/#*$!.php on line 126 |
Just FYI, I am using this code in a wordpress based website.
| 1:29 am on Jul 29, 2012 (gmt 0)|
what is the code on line 126?
| 9:16 am on Jul 29, 2012 (gmt 0)|
hi, I removed that and contacted the braintree about it.
they gave me below code and it worked fine :)
| 6:07 pm on Jul 29, 2012 (gmt 0)|
wow... okay, you would need to know the Braintree API to figure that out.
| 6:32 pm on Jul 29, 2012 (gmt 0)|
Thanks again for your help. Yeah I am working with braintree API.
| 1:25 am on Jul 30, 2012 (gmt 0)|
Yeah, I understood that you were working with Braintree, but who would have known that they had the ->format method on that object?
That's a lot easier than trying to manipulate the data with PHP.