Jump to content

change date format with data back from mysql


jonsamwell

Recommended Posts

Hi,

 

mysql stores date as Y-m-d H:i:s.

 

How would i change the format of the string i get back after a sql query so that the format is "d-m-Y H:i:s".

 

I have tried:

 

$date = date($row['previous_login']);

$date = date_format($date, "d-m-Y G:i:s");

 

but i get back an error.

 

Any ideas?

 

Thanks

 

Jon

$date_s = strtotime($row['previous_login']);

$date = date_format($date_s, "d-m-Y G:i:s");

 

thanks for replying

 

it throws back the error

 

"Warning: date_format() expects parameter 1 to be DateTime, integer given in C:\wamp\www\SRC\PHP\db.php on line 301"

 

any ideas

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.