1

I've tried this but it doesn't seem to be working:

$entry = EntryModel::populateModel(array(
    'dateCreated' => DateTimeHelper::formatTimeForDb($someTimeStamp),
    'sectionId' => 1
    'typeId' => 1
));

craft()->entries->saveEntry($entry);
0

The dateCreated, dateUpdated and uid columns are more internal Craft auditing columns that Craft manages for every row in every table.

Maybe what you're looking for is the postDate column for entries, which you can set a custom value to.

2
  • Thanks, Brad. Is postDate the date you see in the CP when you're creating an entry? We basically want to set that to a date in the past when creating entries via our plugin. – Russ Back Dec 18 '14 at 21:22
  • I believe so, yeah. – Brad Bell Jan 7 '15 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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