How to stop Drupal for setting node changed date on creation? This is my second question about my issues with creating custom migration script.

I am creating only new nodes and don't care about updates.

Code:

        $node = new stdClass();
        $node-&gt;type = 'migrate';
        $node-&gt;title = $content['title'];
        $node-&gt;language = LANGUAGE_NONE;

        $node-&gt;created = (int) date('U',strtotime($content['created']));

        $modified = $content['modified'];               
        if (! empty($modified) &amp;&amp; $modified != '0000-00-00 00:00:00') {
            $modified = (int) date('U',strtotime($modified));
        } else {
            $modified = 0;
        }               
        $node-&gt;changed = $modified;

        node_object_prepare($node);

        #some lines later
        node_save($node);


E.g my $modified is set to 0 and after save I see updated column of this node row in admin content list with current datetime value.
You should be able to preserve the original changed time by first setting a custom property on the node object, say $node-&gt;modified, in your migration script prior to calling node_save(), and then implementing the node_presave hook:

/**
 * Implements hook_node_presave().
 */
function mymodule_node_presave($node) {
  $node-&gt;changed = $node-&gt;modified;
}


This will work since node_save() sets $node-&gt;changed prior to calling all modules which implement hook_node_presave().