Skip to content
Advertisement

Date time format in php – Fatal error: Uncaught Error: Call to a member function format() on string

I have this kind of error, and wondering if there’s anyway I can fix this

JavaScript

that is the error message returning,

My database is saving date and time on a single column but I like them to be separated, is it possible?

Thanks Lads

Advertisement

Answer

it looks like you’re using it without a Model and so the data will be returned in it’s raw format, in this case a string.

Using PHP date and strtotime should give you the time from the ISO8601 string

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement