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\"
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
Post a Comment