PHP Date Format

A common mistake that i always do is to forget the strtotime field

Here is where i usually use it.

Enjoy

Coffee Cup


***************************************************

	//20221117
	if ($pldate != '')
	{
		$pldate = date("m/d/Y", strtotime($pldate));
	}
	
	if ($plcheck_date != '')
	{
		$plcheck_date = date("m/d/Y", strtotime($plcheck_date));	
	}
				
?>	
        <div id="page-wrapper">

***************************************************

$pltype = $_POST['pltype'];
$pltype = htmlspecialchars( $pltype, ENT_QUOTES);

	//20160904
	if ($pldate != '')
	{
		$pldate = date("Y-m-d", strtotime($pldate));
	}
	
	if ($plcheck_date != '')
	{
		$plcheck_date = date("Y-m-d", strtotime($plcheck_date));	
		$plcheck_date2 = date("Y-m-d", strtotime($plcheck_date));	
	}
	else
	{
		$plcheck_date2 = NULL;	
	}

***************************************************


Leave a Reply

Your email address will not be published. Required fields are marked *