note 90714 modified in function.gmmktime by danbrown

From: Date: Tue, 05 May 2009 20:01:52 +0000
Subject: note 90714 modified in function.gmmktime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154261@lists.php.net to get a copy of this message
GMT time is useful for avoiding the daylight's savings issue. I had to use it to get a working date difference function: <?php function dateDiff($date1, $date2) //returns the difference, in days, between two dates. avoids the daylight's savings issue by using GMT { $date1 = date_parse($date1); $date2 = date_parse($date2); return ((gmmktime(0, 0, 0, $date1['month'], $date1['day'], $date1['year']) - gmmktime(0, 0, 0, $date2['month'], $date2['day'], $date2['year']))/3600/24); } ?> --was-- GMT time is useful for avoiding the daylight's savings issue. I had to use it to get a working date difference function: function dateDiff($date1, $date2) //returns the difference, in days, between two dates. avoids the daylight's savings issue by using GMT { $date1 = date_parse($date1); $date2 = date_parse($date2); return ((gmmktime(0, 0, 0, $date1['month'], $date1['day'], $date1['year']) - gmmktime(0, 0, 0, $date2['month'], $date2['day'], $date2['year']))/3600/24); } http://php.net/manual/en/function.gmmktime.php

« previous php.notes (#154261) next »