• Resolved janetSchaper

    (@janetschaper)


    I am getting this error message when trying to view list:
    Message to admin only: Fatal error caught – Unable to create DateTime object from this string: “2017-08-06 23:19:24
    ” Please check the content of your date fields, and any fields where you have specified a date format

    The field is user_registered and I am trying to put it in its own column. In the WordPress settings, I have set the same date/time format as in the “Fields & Nice Names” Field type. When I configure the list, on the Format tab, The “User Registered” field has a pulldown with greyed out selections. But nest to the pulldown there is the indication (date), so I assume it is set as date.

    Can you tel me what the problem is?

    Thanks,
    Janet

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author anmari

    (@anmari)

    Hi Janet,

    the greyed out bits just mean there are more formatting options available through add-ons. Without addons you should be able to choose ‘Date and Time’ or ‘Ago Human time difference’. If you leave it unchosen, the default is ‘Ago’ for historical compatibility.
    The wordpress date and time format settings don’t currently influence it – except for timezone.

    Is it only complaining about the one record out of several? Is that converted data? It’s possible that there are some other non visible characters in there or somehow corrupted. That datestring itself should be fine – works on my system.

    Thread Starter janetSchaper

    (@janetschaper)

    Hi Anmari,
    Thanks for responding so quickly!

    I am really confused now, I played around a bit more with 2 lists that I have. On the Fields & Nice names page, I set the user_registered to nothing Field Type. Then I created a new list and added that field as the last column. It rendered fine, using the “Ago” format. Then I went back to my original list that was throwing the errors. The last column is this user_registered. It is still throwing the errors, 1 for each record. It does not show the “ago” format, though. It shows “2016-05-04 00:00:00”. Which is weird! I refreshed all of the caches I could think of. If I switch the user_registered field to the first column in the list, everything renders fine, and there are no errors thrown.

    Does this make any sense to you? I have no clue what is going on…..

    Janet

    Thread Starter janetSchaper

    (@janetschaper)

    By the way, after all of the error messages, the list renders correctly underneath. Somehow retaining the “2017-08-07 00:00:00” format.

    Plugin Author anmari

    (@anmari)

    Let me check what I think you said:

    User registered field – no special type defined. Which means the old default format (ago) will apply. This happens as expected in 2nd list.

    Original list throws errors, but does show values. Note the the “2017-08-07 00:00:00” format is just the raw data. It most likely has not been formatted – just passed through.

    NOTE user_registered field type MUST be either none or datetime (not date) as the raw data is datetime.

    Sooo, your system must be handling datetime ok, and probably your timezone ok else the 2nd list wouldn’t work. And your data must be ok else again the 2nd list would not work.

    So something has gone wrong with list 1? inconsistent settings or corrupted settings ?
    I’ve played around trying to create a dodgy combination but I cannot get that message to happen. CHeck you don;t have any other date fields in same list just in case.

    Then check your timezone in wp settings,
    then make a note of the user list settings,
    then go to General&About > General and click ‘Reset all options’.
    Exclude as many user meta as you can,
    then find fields, exclude as many of those as you can (keeps the configure list lighter & cleaner).
    Leave/set the user_registered type as datetime.
    Recreate the simplest version of your report in list 1. Check it works.

    If you ok with editing code you could drop
    echo '<p>'.$e->getMessage().'</p>';
    into ameta-includes.php line 32 – before the ‘echo … message to admin’.This will give us the actual php message, which may shed light.

    let me know how it goes.

    Thread Starter janetSchaper

    (@janetschaper)

    Hello Anmari,

    Thank you so much for the response, I will go play around with this as you describe, and get back to you. I did not realize that the

    NOTE user_registered field type MUST be either none or datetime (not date) as the raw data is datetime.

    Cheers,
    Janet

    Thread Starter janetSchaper

    (@janetschaper)

    Hello Anmari,

    So through your very good explanations, I was able to find the problem and rebuild the list without the error messages. You were right on in your comment about the original data in the problem list somehow getting corrupted. I found that the datetime field raw data had somehow gotten corrupted to:

    2017-08-06 23:19:24 !

    Don’t know how that exclamation point character got stuck in there.

    Thank you so much for your help, your support is excellent! I will go give you a great rating!

    Janet

    Thread Starter janetSchaper

    (@janetschaper)

    Hello again,

    Just for future reference, I found out how the problem got introduced. For the user_registered field, in the “Before & After” tab, a <br/> tag in the After field. Since this field is last in the list, it is not needed. It was clearly left over from when this field was combined with another one, and a line break was desired between the two.

    Janet

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Unable to create DateTime object from string’ is closed to new replies.