In PHP, how do I add 3 months to the purchase date retrieved from the iPhone InApp receipt?
Posted
by Cocoanut
on Stack Overflow
See other posts from Stack Overflow
or by Cocoanut
Published on 2010-02-21T12:49:31Z
Indexed on
2010/04/03
1:03 UTC
Read the original article
Hit count: 359
After I have validated the receipt against the App Store from my PHP server, the App Store sends me back a JSON response with
"status" : 0
"receipt" : ( .... )
One of the receipt items is "purchase_date" which contains the following string (example) "2010-02-09 19:17:04 Etc/GMT"
I'm trying to establish a subscription service and would like to add 3 months to this date and then write that expiry date into a MySQL table.
Is there a string-to-date type function in PHP that can allow me to achieve the adding of 3 months?
I have found this example which looks like it adds 1 month to a date:
$date = date("Y-m-d");// current date
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 month");
But I'm not sure how I can turn the string passed by the App Store into a PHP recognised date.
© Stack Overflow or respective owner