I am storing the time a row was created with now()
in my database, type DATETIME.
If i just read out the field where it was stored, it returns 2017-04-09 10:34:31
.
I'm trying to format it like this: date('H:i d F Y', $row->created)
("$row->created" is the database field where my time is stored, it is correct.)
This outputs: Notice: A non well formed numeric value encountered in C:\wamp\www\index.php on line 52
.
So do i need to format the time differently?
Do i need to store via a different time-outputting function?
Instead of this:
date('H:i d F Y', $row->created)
try this:
date('H:i d F Y', strtotime( $row->created ));
Explanation: The data returned by mysql query is of string type so you have to change it to suitable type and then convert its format of your choice.