Bug #18281: strtotime incorrectly evaluates AM/PM

From: Date: Thu, 11 Jul 2002 17:39:23 +0000
Subject: Bug #18281: strtotime incorrectly evaluates AM/PM
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-13864@lists.php.net to get a copy of this message
From:             mwilmes@avc.edu
Operating system: Win 2K
PHP version:      4.2.1
PHP Bug Type:     Date/time related
Bug description:  strtotime incorrectly evaluates AM/PM

I'm writing a timeclock for work, but have a problem processing 12 hour
times:

--Script--
<?php
$T=array('05:00 PM','05:00PM','5:00 PM','5:00PM');
foreach ($T as $TIME)
{
  echo $TIME.'<br>';
  echo strtotime($TIME).'<br>';
  echo date("Y-m-d h:i:s",strtotime($TIME)).'<br><br>';
}
?>

--Output--
05:00 PM
1026432000
2002-07-11 05:00:00

05:00PM
1026432000
2002-07-11 05:00:00

5:00 PM
1026432000
2002-07-11 05:00:00

5:00PM
1026432000
2002-07-11 05:00:00

I've compiled PHP 4.2.1 for Apache 2.0.39 with SSLOpen 0.9.7 beta 2.  PHP
is installed as a module.

Is it me or my box?
Thanks in advance,
Mike Wilmes
-- 
Edit bug report at http://bugs.php.net/?id=18281&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=18281&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=18281&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=18281&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=18281&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18281&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=18281&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=18281&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=18281&r=submittedtwice
register_globals:    http://bugs.php.net/fix.php?id=18281&r=globals



Thread (5 messages)

« previous php.bugs (#13864) next »