Bug #18281 Updated: strtotime incorrectly evaluates AM/PM

From: Date: Thu, 11 Jul 2002 19:15:15 +0000
Subject: Bug #18281 Updated: strtotime incorrectly evaluates AM/PM
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-13873@lists.php.net to get a copy of this message
 ID:               18281
 Updated by:       sniper@php.net
 Reported By:      mwilmes@avc.edu
-Status:           Open
+Status:           Bogus
 Bug Type:         Date/time related
 Operating System: Win 2K
 PHP Version:      4.2.1
 New Comment:

Your script is buggy. Read this manual page a bit more carefully:
http://www.php.net/manual/en/function.date.php

h - hour, 12-hour format; i.e. "01" to "12"                  H - hour,
24-hour format; i.e. "00" to "23" 




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

[2002-07-11 13:39:23] mwilmes@avc.edu

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 this bug report at http://bugs.php.net/?id=18281&edit=1



Thread (5 messages)

« previous php.bugs (#13873) next »