int AddToTimeStamp( array add, int timestamp = false )
The function AddToTimeStamp adds the specified time span to a date in Unix format.
Parameter | Description |
---|---|
add | Array containing the time span. The following keys are possible:
|
timestamp | Time value in Unix format to which the time span is to be added. Optional; the current time is used by default. |
Returns the resulting date in the Unix format.
$date = "07.04.2005 11:32:00"; echo "Original date: ".$date."<br>"; // obtain Unix timestamp from the source date $stmp = MakeTimeStamp($date, "DD.MM.YYYY HH:MI:SS"); // add 1 day, 1 month, 1 year, 1 min and 1 sec $arrAdd = array( "DD" => 1, "MM" => 1, "YYYY" => 1, "HH" => 1, "MI" => 1, "SS" => 1, ); $stmp = AddToTimeStamp($arrAdd, $stmp); // print the result echo "Result: ".date("d.m.Y H:i:s", $stmp); // 07.03.2007 12:33:01 ?>
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |