note 128984 added to function.strtotime
| From: | achillosilliasos at gmail dot com | Date: | Sun, 29 Oct 2023 20:32:28 +0000 |
| Subject: | note 128984 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220941@lists.php.net to get a copy of this message | ||
Remember that if you want to query a database for the last 24 hours in a MySQL-query like:
SELECT * FROM mytable WHERE date BETWEEN '$lastday' AND '$date'
Then using:
$date = date('Y-m-d');
$lastday = date('Y-m-d',strtotime("-1 day"));
will give you today + yesterday all day.
Instead you need to do:
$lastday = date('Y-m-d',strtotime("-1 day + 24 hours"));
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 83.132.89.186)
----
Manual Page -- https://php.net/manual/en/function.strtotime.php
Edit -- https://main.php.net/note/edit/128984
Del: integrated -- https://main.php.net/note/delete/128984/integrated
Del: useless -- https://main.php.net/note/delete/128984/useless
Del: bad code -- https://main.php.net/note/delete/128984/bad+code
Del: spam -- https://main.php.net/note/delete/128984/spam
Del: non-english -- https://main.php.net/note/delete/128984/non-english
Del: in docs -- https://main.php.net/note/delete/128984/in+docs
Del: other reasons-- https://main.php.net/note/delete/128984
Reject -- https://main.php.net/note/reject/128984
Search -- https://main.php.net/manage/user-notes.php