Jump to content

MySQL Date to Human --- Gone Wild


rlelek

Recommended Posts

Anyone have any idea why this keeps returning the wrong date?

 

function mysql_date_to_human($dt)

{

    $yr=strval(substr($dt,0,4));

    $mo=strval(substr($dt,5,2));

    $da=strval(substr($dt,8,2));

  return date("d/m/Y", mktime (0,0,0,$da,$mo,$yr));

}

 

 

Example....

if the database column reads "2006-06-20"

it will output "06/08/2007" when the function is called.

 

Thanks for your help!

Link to comment
https://forums.phpfreaks.com/topic/97711-mysql-date-to-human-gone-wild/
Share on other sites

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.