note 72366 added to function.strtotime

From: Date: Tue, 16 Jan 2007 10:47:33 +0000
Subject: note 72366 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-121789@lists.php.net to get a copy of this message
A hint not to misunderstand the second parameter: The parameter "[, int now]" is only used for strings which describe a time difference to another timestamp. It is not possible to use strtotime() to calculate a time difference by passing an absolute time string, and another timestamp to compare to! Correct: $day_before = strtotime("+1 day", $timestamp); # result is a timestamp relative to another Wrong: $diff = strtotime("2007-01-15 11:40:00", time()); # result it the timestamp for the date in the string; # because the string contains an absolute date and time, # the second parameter is ignored! # instead, use: $diff = time() - strtotime("2007-01-15 11:40:00"); ---- Server IP: 195.26.5.2 Probable Submitter: 213.169.107.101 ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- https://master.php.net/note/edit/72366 Del: integrated -- https://master.php.net/note/delete/72366/integrated Del: useless -- https://master.php.net/note/delete/72366/useless Del: bad code -- https://master.php.net/note/delete/72366/bad+code Del: spam -- https://master.php.net/note/delete/72366/spam Del: non-english -- https://master.php.net/note/delete/72366/non-english Del: in docs -- https://master.php.net/note/delete/72366/in+docs Del: other reasons-- https://master.php.net/note/delete/72366 Reject -- https://master.php.net/note/reject/72366 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#121789) next »