php - Correct date format for publication date youtube api -


getting following error when try put date in 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\" malformed @ \" 00:00:00\"

"invalid value for: invalid format: \"2015-04-14 00:00:00\" malformed @ \" 00:00:00\"

what correct format needed set publication date when uploading video youtube?

according youtube api format should

yyyy-mm-ddthh:mm:ss.sz 

how correctly in php?

you need use iso 8601 format, see here correct selector.

as example, can use in code follow:

$date = date_create($this->output->publication_date); $formatted = $date->format('c');  

or

date_format(date_create($this->output->publication_date), 'y-m-d\th:i:s.z\z'); 

hope help


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -