3

Having much success with the Import Plugin

I've also raised this here, but thought this forum perhaps better.

I'm trying to force through a Post Date on my imports, but nothing is being respected, also, doesn't map automatically. All other fields have imported flawlessly, but PostDate seems to stick with the current date (not the date from years ago I want to be the postDate.

Can I check please?

I have CSV column titled tried a few but thought "postDate" would work best. Date format, matched "31/07/2014" to the field, and "31/07/2014 00:00" but can't get anything to stick though any method (append, or replace)

Thanks in advance.

3

I haven't yet used the plugin, but I'd try to import the dates into another, custom datetime field (e.g. myImportDate) to see if it's a problem with postDate being a special field (also goes into other tables in the DB, as far as I know). This would be for testing purposes only...

Another hint that might help:
Craft usually saves a datetime in a format like so: "2014-07-31 12:00:00". I've no idea if this is relevant for your plugin though. Same applies for the timezone, as Craft saves a datetime in UTC. As the plugin uses the saveEntry API, you probably don't have to care about the timezone, but the string format could break it for you.

Edit:

OK,postDate should be possible and the timezone defined after Craft install should be used to save datetime values. I'd bet it's the unusual "31/07/2014 00:00" format, Simon!

2

Yes, thanks carlcs!

So, as long as your postDate is set to this format "2014-07-31 12:00:00" and NOT your localised version as it appears in the Control Panel, everything works. Thanks to the magic of the import plugin, I can overwrite just the one field.

  • Think I could get a peek at your Import code? Are you formatting this as a string or a date? – Steve Mock Sep 14 '16 at 17:28

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.