phpdatetimelaravel-5paypal-sandboxdate-formatting

Returned date of paypal payment agreement


In laravel 5.8 app working with paypal/rest-api-sdk-php making payment agreement I retrieved data from paypal server with date in

2019-11-09T08:00:00Z

format I need to convert it to mysql format. I think I can use str_replace function to convert to mysql format, but I am not sure if it is a good way? What type of format it support and what is the proper way for converting?


Solution

  • You can use strtotime function

    $timestamp = strtotime($date);
    

    to convert it to date time and convirt it to common mysql format:

    $start_date= date('Y-m-d H:i:s', $timestamp);