how to fix the date time conversion error log ( DateTime::__construct(): Failed to parse time string)

Hey everyone,

I have this error since the beggining and I dont know why :
On account :

Conversion of 28/11/2019 17:53 from string failed: DateTime::__construct(): Failed to parse time string (28/11/2019 17:53) at position 0 (2): Unexpected character

On lead :

Tue Dec  3 09:27:14 2019 [13112][b872a9c9-14f2-d1ba-aa03-5c5adc1c9947][ERROR] fromUser: Conversion of 2019-12-02 12:34:30 from user format d/m/Y H:i failed
Tue Dec  3 09:27:14 2019 [13112][b872a9c9-14f2-d1ba-aa03-5c5adc1c9947][ERROR] fromUser: Conversion of 2019-12-03 08:27:14 from user format d/m/Y H:i failed

Those two error come from include/TimeDate.php (line 876 to 910)

My modified-date and created_date is saving correctly, I mean if I save at 10h48 I will see 10h48 in modified date.

But I get this annoying error everytime I save.

What I have already done :

  • Set correct timezone in PHP.ini
  • changed the timezone / datetime format for every user -> Everyone have the same settings
  • QR&R

If someone have the solution plz right it for all other that have it !

When do you get those errors?

Its in the suitecrm.log file, every time I save an entry

Dates will always be a problem because of the different formats out there. The problem is bigger when you create your own dates from logichooks. To solve it I always try to work dates directly on the DB.

Now just for information please read this thread.



@AlxGr, I used one of the default format from SuiteCRM.

In Local settings :

So maybe its from the CRM itself ?

I’ve seen this error many times before, I believe there is also a GitHub issue for it somewhere, but I can’t search right now.

It’s probably nothing to worry about, although I do wish we could remove this spamming from the logs.

Do you have any symptom to accompany this? Anything not working as it should?

Everything is working great. Its just, as you said, a spamming thing in the log file.

After some research its possible that the function only need a date without slashes ("/").

I just googled the error on internet to find this, so its maybe deeper.

I have some thing to fix first, if one day I have some day off I will try to fix this !

1 Like

As @pgr mentioned before. There is nothing to worry about. Now if one day you need to modify dates inside a Logichook, based on my experience, it’s better to work on the DB directly.



I can understand that but, I will have to comment the line cause its spamming my log and its a bit messy to rly find the error I should focus on (to fix them). When I have this error on every edit cause my user use the CRM everyday.