note 20348 deleted from ref.datetime by danbrown

From: Date: Sun, 20 Jul 2008 02:28:56 +0000
Subject: note 20348 deleted from ref.datetime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141963@lists.php.net to get a copy of this message
Note Submitter: mwedgwood at ILUVSPAMhotmail dot com ---- In vincentv's examples, you should use gmmktime instead of mktime for portability across time zones. For example: function DateSub($timestamp, $unit, $amount) { // Possible $units are: "hr", "min", "sec", // "mon", "day", or "yr" // $amount should be an integer $delta_vars = array("hr"=>0, "min"=>0, "sec"=>0, "mon"=>1, "day"=>1,"yr"=>1970); $delta_vars[$unit] += $amount; $delta = gmmktime($delta_vars["hr"], $delta_vars["min"], $delta_vars["sec"], $delta_vars["mon"], $delta_vars["day"], $delta_vars["yr"]); return $timestamp - $delta; }

« previous php.notes (#141963) next »