Convert a date with format (2017-05-27) to save in node created field
The node created field is a Timestamp Field. Use the php function strtotime() to convert the string to a Unix timestamp:

$timestamp = strtotime('2017-05-27');


and store the value in the created field:

$node-&gt;created-&gt;value = $timestamp;


You can also use the method setCreatedTime():

$node-&gt;setCreatedTime($timestamp);