Bug #52123 [Bgs]: strtotim() returns date for one year ago

From: Date: Sat, 19 Jun 2010 10:59:39 +0000
Subject: Bug #52123 [Bgs]: strtotim() returns date for one year ago
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-151621@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52123&edit=1

 ID:               52123
 User updated by:  alipendashteh at gmail dot com
 Reported by:      alipendashteh at gmail dot com
 Summary:          strtotim() returns date for one year ago
 Status:           Bogus
 Type:             Bug
 Package:          Date/time related
 Operating System: Windows
 PHP Version:      5.3.2

 New Comment:

you right; this is not a bug.
but i think the "Y, F j" is much more common than "Hi, F j".
and many application like Drupal use "Y, F j" as a default date format.
so parsing date as "Hi, F j" rather than "Y, F j" would cause confiusing
errors in applications.
I suggest replace the priorities of two format mentioned.


Previous Comments:
------------------------------------------------------------------------
[2010-06-19 11:41:47] derick@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

This is not a bug. 2011 is seen as time instead:

php -r 'var_dump(date_parse("2011, February 8"));'
array(12) {
  ["year"]=>
  bool(false)
  ["month"]=>
  int(2)
  ["day"]=>
  int(8)
  ["hour"]=>
  int(20)
  ["minute"]=>
  int(11)
  ["second"]=>
  int(0)
  ["fraction"]=>
  bool(false)
  ["warning_count"]=>
  int(0)
  ["warnings"]=>
  array(0) {
  }
  ["error_count"]=>
  int(0)
  ["errors"]=>
  array(0) {
  }
  ["is_localtime"]=>
  bool(false)
}

------------------------------------------------------------------------
[2010-06-19 11:22:14] alipendashteh at gmail dot com

Description:
------------
Hi,
strtotime returns wrong date (one year ago) with some formats like:
2011, February 8


Test script:
---------------
echo (date('Y-m-d', strtotime("2011, February 8")));

Expected result:
----------------
2011-02-08

Actual result:
--------------
2010-02-08


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52123&edit=1


Thread (6 messages)

« previous php.bugs (#151621) next »