K Ф February 2016
Correct date format for publication date youtube api
Getting the following error when I try to put the date in the follwing format:
date_format(date_create($this->output->publication_date), 'Y-m-d H:i:s');
"Invalid value for: Invalid format: \"2015-04-14 00:00:00\" is
malformed at \" 00:00:00\"
What is the correct format that is needed to set the publication date when uploading a video to youtube?
According to the youtube api the format should be
How to do this correctly in PHP?
Matteo February 2016
You need to use the ISO 8601 format, see here for the correct selector.
As example, you can use it in your code as follow:
$date = date_create($this->output->publication_date);
$formatted = $date->format('c');
hope this help
Asked in February 2016
Viewed 1,035 times
Answered 1 times
Leave an answer
Quote of the day: live life