I’m reading lines from a *.txt file and get strings (date formats) in this style: With the function DateTime::createFromFormat, I want to convert such lines into a time string. After that, I would like to get the timestamp with getTimestamp();. So, currently my code looks like this ($date is my read line): When I try to do this, I get
Tag: date-format
How convert this date: “16/11/2020 12:00:00 a. m.” to “2020-11-16 00:00:00” with PHP?
Currently, I am requesting an external web service to get some important information. However, the dates this web services return me are something like this: 16/11/2020 12:00:00 a. m. So, I was in other implementations using a code like this to get the DateTime: But it throws this error: DateTime::__construct(): Failed to parse time string (16/11/2020 12:00:00 am) at position