Change creation date of an entry

I’m moving “old” content to my cockpit instance but the entry date is the current date (obviously) but i need to change the dates so that the content is chronologically. How can i change the creation date?

I don’t know, how to change the creation date, but if you use the backend for importing collections, you lose '_id', '_uid', '_created', '_modified'

If you use the cli, all original data gets stored.

  • Open your console, navigate to cockpit and run ./cp export --target outputfolder (or maybe php ./cp ...)
    • Now you have an “outputfolder”, which contains the folders /cockpit, /singletons, /collections.
    • Delete the folders and files, you don’t want to import.
  • Create a collection “newcollectionname” in your new Cockpit.
  • Rename outputfolder/collections/oldcollection.json to outputfolder/collections/newcollectionname.json if you changed the name.
  • run ./cp import --src outputfolder in your new cockpit

All your old collection data should be stored with original ids and dates.

I’m importing posts from an entirely different system so modifying the creation date of a collection item would be useful to me.

I’d be interested in changing creation dates as well.
Is there a way to do this by now?

I was looking for this too on importing data.

I created a temporary field _created_at in the collection and filled it with the original creation date (in unix timestamp format), then hooked into collection.safe.before.[CollectionName] with

$app->on('collections.save.before.xxx', function($collection,&$entry,$isUpdate){

    if($entry['_created_at']) {
        $entry['_created'] = $entry['_created_at'];
        $entry['_created_at'] = '';
    }

});

This event is fired on every save action, so during the import of every item it gets fired too.
Afterwards you can delete the code and the temporary field.

This worked for me …