• Resolved dwcouch

    (@dwcouch)


    I completely agree with you on the proper use of the date fields. The issue was the CSV I receive from the client has dates such as ’91 08 13′ and ’12 12 12′. I anticipate periodic imports of the csv so I’m looking for a workflow to import said csv’s with minimal steps.

    Is there a date format that PDB is looking for? Or can I specify a filter? ‘yy mm dd’? Or do I need to manually go through the csv and change all the dates to a particular format before I import every few weeks?

    Thank you.

    BTW sorry about the post derails… I actually thought I was in the right place :-/

    https://ww.wp.xz.cn/plugins/participants-database/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Roland Barker

    (@xnau)

    A date field exports/imports its data in human-readable date formats, and then converts them to UNIX timestamps for storage in the database. It will have a hard time with your dates as they are because the format isn’t consistent and two-number years are prone to errors.

    What I suggest you do is create a spreadsheet that processes the CSV into a format that will work well for Participants Database. What the spreadsheet can do for you is translate your date strings into a consistent, parseable format. I usually do that by having the imported dates in a “dummy” column (that is, one that won’t be imported) that serves as the data source for the real date column. Then you can use a formula to convert the input date format to a suitable output date format.

    Once you have the data conditioned, export that into a CSV to be imported into Participants Database. You can use the same spreadsheet over and over if you set it up right.

    A good, non-ambiguous format is something like “June 3, 2016” or “06-03-2016” ( I know the second can be ambiguous, but PHP assumes the month value is first.)

    New topics are good because it helps others find useful information.

    Thread Starter dwcouch

    (@dwcouch)

    Thank your for your time and recommendations.

    Turns out that I am receiving an XLS file. Why the dates are formatted the way they are is beyond me. But at any rate, I found I’m able to simply select the 4 columns that contain dates re-format them – I opted for “January 1, 2016” as you suggested.

    After that workflow consists of replacing the top row of Plain English Headings with under_score_headings via copy and paste.

    PDB field settings are appropriately set to ‘date’.

    The import works great. Date columns sort accordingly.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Date formatting and csv import’ is closed to new replies.