Jump to content

date function


vj5

Recommended Posts

Assuming all of your days are that format:

$string = '20080108';$year = substr($string,0,4);$month= substr($string,4,2);$day = substr($string,6);//This last one doesn't require a third argument because we are going to the end of the string$timestamp = mktime(0,0,0,$month,$day,$year);echo date('l F d, Y',$timestamp);

You should use the time() function to store your database date information. It saves you a few lines of code.

Link to comment
Share on other sites

Assuming all of your days are that format:
$string = '20080108';$year = substr($string,0,4);$month= substr($string,4,2);$day = substr($string,6);//This last one doesn't require a third argument because we are going to the end of the string$timestamp = mktime(0,0,0,$month,$day,$year);echo date('l F d, Y',$timestamp);

You should use the time() function to store your database date information. It saves you a few lines of code.

Thank you for the code.
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...