mktime() Kalender Problem -gelöst

Coderecke
Post Reply
Message
Author
User avatar
rebirther
Admin
Posts: 2902
Joined: 19.12.2005, 00:59
Location: Germany

mktime() Kalender Problem -gelöst

#1 Post by rebirther » 24.07.2010, 21:06

Code: Select all

function mydateformat($thisdate, $dateformat='d M Y G:i', $span=0)
{
	global $cal_config;

	if ($cal_config['cal_dateformat']) {
		$dateformat = $cal_config['cal_dateformat'];
		}

	// date comes in as the following:
	$myr = substr($thisdate, 0, 4);
	$mym = substr($thisdate, 5, 2);
	$myd = substr($thisdate, 8, 2);
	$myh = substr($thisdate, 11, 2);
	$myn = substr($thisdate, 14, 2);
	$mys = substr($thisdate, 17, 2);

	if ($span || ($myh=='00' && $myn=='00' && $mys=='00')) {
		// Need to strip out any TIME references so...
		$timerefs = array ('a','A','B','g','G','h','H','i','I','s');
		while (list(,$val) = each ($timerefs))
			{
			$dateformat = ereg_replace($val, "", $dateformat);
			}
		// strip out any characters used for time
		$dateformat = ereg_replace('[:\.]', " ", $dateformat);
	}

	$returndate = date($dateformat, mktime ($myh,$myn,$mys,$mym,$myd,$myr)); 
	return $returndate;
}

Code: Select all

 mktime() expects parameter 1 to be long,
mktime() expects parameter 3 to be long,
$returndate = date($dateformat, mktime ($myh,$myn,$mys,$mym,$myd,$myr));

Lösung:

Code: Select all

$returndate = date($dateformat, mktime ($myh+0,$myn+0,$mys+0,$mym+0,$myd+0,$myr+0));

Post Reply