Full PayPal Date Format

PayPal will send the payment_date field in the following format 19:19:09 September 27, 2011

I use php to calculate the days left with payment_date, but my code is based on getting the format in 2011-09-27 12:19:00.

How do i change?

This is my code (which works fine if the date is in my correct format):

<?php $today = time(); $cdate = strtotime('2011-09-27');//strtotime($row_details['payment_date']);// testing $dateDiff = $today - $cdate; $fullDays = floor($dateDiff/(60*60*24)); $dayscalculate = 30 - $fullDays; // Set number of days echo $dayscalculate.(($dayscalculate == 1) ? " day" : " days"); ?> 

thanks

+4
source share
2 answers

There should not be any problems. strtotime() will accept the PayPal format as:

 strtotime("19:19:09 Sep 27, 2011") 

Just make sure your php.ini is set to the correct time zone or at runtime with date_default_timezone_set()

+6
source
 <?php $end = date('Ymd H:i:s', strtotime("03:49:26 27 May 2013 PDT")); echo $end; ?> 

Result: 2013-05-27 11:49:26

+6
source

All Articles