1

Is there a module that allows me to change the dates of all nodes at once instead of doing it one by one thanks.

1 Answer 1

1

In this case, you could update the field in the db, much faster than node_loading and saving all the nodes with batch update etc.. backup db first.

Fields are:

node.created
node.changed
node_revision.timestamp (same as node changed)

e.g

$created = strtotime('2013-01-01 00:00:00');
$changed = REQUEST_TIME; // now

$query = db_update('node');
$query->fields(array('created' => $created, 'changed' => $changed));
$updated = $query->execute();

$query = db_update('node_revision');
$query->fields(array('timestamp' => $changed));
$updated = $query->execute();

drupal_flush_all_caches(); // clear cache
2
  • Is there a way to do it through the Admin UI as I also like to show my clients how to do some functions. They usually don't know how to code... Jan 22, 2013 at 2:34
  • 1
    If you want to try that way, you could do something with views_bulk_operations and either a default update operation, or a rules component to set the date value. Jan 22, 2013 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.