note 86084 modified in function.mktime by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Don't know about others, but this makes more sense to me:

<?php
function dateserial($year,$month,$day,$hour,$minute,$timezone = "UTC") {
	$orgTZ = date_default_timezone_get();
	date_default_timezone_set($timezone);
	$retval = mktime($hour,$minute,0,$month,$day,$year);
	date_default_timezone_set($orgTZ);
	return $retval;
}
?>

The order makes more sense and the timezone defaults to UTC unless otherwise specified. The fact that you have to set the timezone gives you more control and forces you to be aware of it.

--was--
Don't know about others, but this makes more sense to me:

function dateserial($year,$month,$day,$hour,$minute,$timezone = "UTC") {
	$orgTZ = date_default_timezone_get();
	date_default_timezone_set($timezone);
	$retval = mktime($hour,$minute,0,$month,$day,$year);
	date_default_timezone_set($orgTZ);
	return $retval;
}

The order makes more sense and the timezone defaults to UTC unless otherwise specified. The fact that you have to set the timezone gives you more control and forces you to be aware of it.

http://php.net/manual/en/function.mktime.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.