#44426 [Opn->Asn]: support for new format of milliseconds in strtotime()

From: Date: Thu, 13 Mar 2008 10:27:47 +0000
Subject: #44426 [Opn->Asn]: support for new format of milliseconds in strtotime()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-123252@lists.php.net to get a copy of this message
 ID:               44426
 Updated by:       johannes@php.net
 Reported By:      krister dot karlstrom at arcada dot fi
-Status:           Open
+Status:           Assigned
 Bug Type:         Feature/Change Request
 Operating System: Ubuntu
 PHP Version:      5.2.5
-Assigned To:      
+Assigned To:      derick
 New Comment:

Assigned to Derick


Previous Comments:
------------------------------------------------------------------------

[2008-03-13 08:05:11] krister dot karlstrom at arcada dot fi

Description:
------------
The default datestring format returned by MS-SQL 2000 through the
MS-SQL support in PHP 5.2.3 (Ubuntu package) using the provided FreeTDS
library contains milliseconds that are separated with a colon, not a
dot. This breaks the parsing of the datestring in strtotime(), which
only seems to allow milliseconds separated by a dot. For compatibility
it would be great if strtotime() also could parse these strings.

This is the format returned by MS-SQL 2000 from a datetime column:
Aug 27 2007 12:00:00:000AM

I hereby request that strtotime() should be able to parse this string,
with our without the AM/PM (using 12 h or 24 h-format). For
compatibility issues it would probably also be good if strtotime() could
parse the string Aug 27 2007 12:00:00.000AM, since it for now doesn't
allow the 12 h-format together with milliseconds.

Reproduce code:
---------------
echo "TIME: ".strtotime("Aug 27 2007 12:00:00:000AM");
echo "TIME: ".strtotime("Aug 27 2007 12:00:00.000AM");
echo "TIME: ".strtotime("Aug 27 2007 12:00:00:000");
echo "TIME: ".strtotime("Aug 27 2007 12:00:00.000");
echo "TIME: ".strtotime("Aug 27 2007 12:00:00AM");
echo "TIME: ".strtotime("Aug 27 2007");
echo "TIME: ".strtotime("Aug 27 2007 12:00AM"); 

Expected result:
----------------
TIME: 1188162000 
TIME: 1188162000 
TIME: 1188205200
TIME: 1188205200
TIME: 1188162000
TIME: 1188162000
TIME: 1188162000 

Actual result:
--------------
TIME:
TIME:
TIME:
TIME: 1188205200
TIME: 1188162000
TIME: 1188162000
TIME: 1188162000 


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


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



Thread (3 messages)

« previous php.bugs (#123252) next »