Date

Closed

Import WP Updated 3 days ago 5 Replies

Ron asked 2 weeks ago on February 5, 2025 at 9:14 pm

Hi,

I’m using the most recent version of ImportWP Pro. But it wouldn’t recognize my license key. But my question…

Is there a way I can convert the pub date? I’m importing a media feed and its date format is not validating.

It validated for the other feed which reference the media pages and not the media. Do you think it would work if I had two feeds as long as the unique identifier was the same?

-Ron

J

James replied Support Agent

2 weeks ago on February 5, 2025 at 10:40 pm

Hi Ron,

The license code from codecanyon, can be converted to allow updates via wp admin: https://www.importwp.com/docs/automatic-updates/

Most dates in wordpress need to be stored in Y-m-d H:i:s , you can do this by converting dates using a custom method/function that is added to your themes functions file, via a plugin or code snippet.

For example if you had a date in your feed in the format dd/mm/yyyy , you could conver this by adding the following code to your website:

function iwphd1045_convert_date($input = ''){
    $date = date_create_from_format('d/m/Y', $input);
    return $date ? $date->format('Y-m-d H:i:s') : '';
}

Then you would use it in your importer replacing the data selection  {1} with [iwphd1045_convert_date("{1}")]

The only issue with using 2 feeds is if you enable the delete permission each importer will delete records that are no longer found in each feed seperatly.

Just to mention that i will not be able to answer support tickets until Monday the 10th as i am out of office until then, sorry for any inconvienence.

James

RP

Ron replied

2 weeks ago on February 5, 2025 at 11:09 pm

Hi James,

Thank you for the quick response. That didn't work.

This is what I put for the date: [iwphd1045_convert_date(“{/pubDate}")]

This is what pubDate looks like in the mrss feed: Tue, 04 Jun 2024 17:00:00 -0400

Oh, I think I get it. I need to replace the format in the feed in your example.

Will test it out in the morning and follow up.

-Ron

 

RP

Ron replied

2 weeks ago on February 7, 2025 at 2:59 pm

Hi James,

I figured out the issue, but not sure what do do for a solution.

When the value is passed to the function it is passing only the day of the week portion of the timestamp, which is followed by a comma. So, before it is passed to the function the value is being split on the comma. I understand why you would split on the delimiter, but I would think a field like date shouldn't be split.

-Ron

J

James replied Support Agent

2 weeks ago on February 10, 2025 at 9:46 pm

Hi Ron,

Are you able to attach the function you are using, and a copy of the csv / xml file that generates the issue and let me know which record it is doing this.

Can you please also export and attach your importer settings to this ticket by going to Tools > Import WP > Settings / Tools > Import / Export and select and export your importer as a JSON file.

This way i can replicate your issue locally and hopefully resolve it.

James

J

James replied Support Agent

3 days ago on February 19, 2025 at 5:20 pm

Hello Ron

This ticket is being marked as closed due to inactivity.

If this is not the case, please reply to this ticket to re-open it.

James