Bug #66257 [NEW]: strtotime doesn't use current timezone on '4 thursdays'

From: Date: Tue, 10 Dec 2013 18:09:07 +0000
Subject: Bug #66257 [NEW]: strtotime doesn't use current timezone on '4 thursdays'
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183230@lists.php.net to get a copy of this message
From:             mfaust at usiwireless dot com
Operating system: Linux
PHP version:      5.4.22
Package:          Date/time related
Bug Type:         Bug
Bug description:strtotime doesn't use current timezone on '4 thursdays'

Description:
------------
---
From manual page: http://www.php.net/function.strtotime
---
date_default_timezone_set('UTC');
$timestamp = mktime(0,0,0,11,1,2014);

strtotime('4 thursdays', $timestamp) does not return the same timestamp
as strtotime('first thursday + 3 weeks', $timestamp)

The first call returns a timestamp indicating a time of 6am (we are in
CST) and the second returns a timestamp indicating 12am.

Test script:
---------------
//The server timezone is America/Chicago
$timestamp = mktime(0,0,0,11,1,2014);
echo strtotime('4 thursdays', $timestamp) . "\n";
strtotime('first thursday + 3 weeks', $timestamp) . "\n";

Expected result:
----------------
Both should return the same timestamp indicating 12:00 am.


-- 
Edit bug report at https://bugs.php.net/bug.php?id=66257&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=66257&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=66257&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=66257&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=66257&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=66257&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=66257&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=66257&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=66257&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=66257&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=66257&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=66257&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=66257&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=66257&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66257&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=66257&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=66257&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=66257&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66257&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=66257&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=66257&r=mysqlcfg



Thread (12 messages)

« previous php.bugs (#183230) next »