I am working on a plugin that has a date picker only (no time). I am attempting to set the postDate
to the value of whatever date was chosen on the front-end. I realize I need to save in this format: Y-m-d H:i:s
$start = craft()->request->getPost('startDate'); // 09/27/2015
// I'm not doing this right as it returns nothing.
$post = DateTime::createFromString($start);
// Returns a datetime object, but doesn't save.
$post = new \DateTime($start);
DateTime Object (
[date] => 2015-09-27 00:00:00.000000 // trim the last decimal?
[timezone_type] => 3
[timezone] => UTC
)
I don't really care what the time is. It could always be midnight, or get the current time from the server. What is the best way to "assemble" the datetime?