[php-src] Issue #20153: strtotime ignores timezone for "now"
| From: | kkmuffme | Date: | Sun, 12 Oct 2025 20:09:21 +0000 |
| Subject: | [php-src] Issue #20153: strtotime ignores timezone for "now" | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251047@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20153
Author: kkmuffme
### Description
https://3v4l.org/doBhT
The following code:
```php
<?php
echo date_default_timezone_get() . PHP_EOL;
echo time() . PHP_EOL;
echo strtotime('now') . PHP_EOL;
date_default_timezone_set('America/Los_Angeles');
echo date_default_timezone_get() . PHP_EOL;
echo time() . PHP_EOL;
echo strtotime('now') . PHP_EOL;
```
Resulted in this output:
```
Europe/Amsterdam
1760299473
1760299473
America/Los_Angeles
1760299473
1760299473
```
But I expected this output instead:
strtotime timestamps should not be in UTC time zone because
https://www.php.net/manual/en/function.strtotime.php
>Each parameter of this function uses the default time zone
When using e.g. '2025-10-12' instead of 'now' it suddenly does not ignore the
timezone anymore
### PHP Version
```plain
PHP 5.x-8.4
```
### Operating System
_No response_