how to programmatically set unpublish_on How can I programmatically set the unpublish_on field(scheduler module) for a node entity in drupal 7?

$entity = entity_metadata_wrapper('node', $node);
$entity-&gt;language(LANGUAGE_NONE);
$entity-&gt;title = 'My Title';
$entity-&gt;body-&gt;set(array(
    'value' =&gt; $body,
    'summary' =&gt; $summary,
    'format' =&gt; 'full_html',
  ));
$entity-&gt;scheduler_settings-&gt;set(array(
    '#required' =&gt; TRUE,
    '#unpublish_on' =&gt; '2018-06-25 12:23:11',
    '#date_format' =&gt; 'd.m.Y H:i:s',
  ));
Follow the examples set by the scheduler module when it loads, inserts, and builds the form. Add the unpublish_on property to the node object with the value of the UNIX timestamp (of when it will unpublish). When the node is saved, the scheduler module will save the unpublish date.

$node = node_load(123);
$node-&gt;unpublish_on = strtotime("2018-06-25 12:23:11");
node_save($node);