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

 ID:                 53964
 Comment by:         greg at pwsdb dot com
 Reported by:        greg at pswdb dot com
 Summary:            minutes on date function incorrect; see examples
 Status:             Bogus
 Type:               Bug
 Package:            *General Issues
 Operating System:   fedora 13
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

echo  '<br>' . date("h:m:s a");

produces 

02:02:26 pm 

and (4 sec. later) 

my interactive fedora 14 command $ date 

produced 

Tue Feb  8 14:58:30 EST 2011

which is correct: It is 58 minutes after the hour, not 2 right now. 

... therefor, it is the date function in PHP, not linux, and it is not

the strtotime function. this time, it was not involved.


Previous Comments:
------------------------------------------------------------------------
[2011-02-08 20:45:28] johan...@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

Your format string includes "m" as in month twice. You need an "i" for
minutes.



date("Y-m-d h:i:s",$i);

------------------------------------------------------------------------
[2011-02-08 20:40:57] greg at pswdb dot com

Description:
------------
---

>From manual page: http://www.php.net/function.date

---

  $d="2010-01-31 09:06:09"; 

  $i= strtotime($d);    

  echo  '<br>' . $d  ; 

  echo  '<br>' . date("Y-m-d h:m:s",$i); 

produces this:

2010-01-31 09:06:09

2010-01-31 09:01:09





  $d="2011-01-20 09:48:00"; 

  $i= strtotime($d);    

  echo  '<br>' . $d  ; 

  echo  '<br>' . date("Y-m-d h:m:s",$i); 

produces this:

2011-01-20 09:48:00

2011-01-20 09:01:00





  $d="2010-06-26 01:29:39"; 

  $i= strtotime($d);    

  echo  '<br>' . $d  ; 

  echo  '<br>' . date("Y-m-d h:m:s",$i); 

produces this:

2010-06-26 01:29:39

2010-06-26 01:06:39 







Expected result:
----------------
2010-01-31 09:06:09

2010-01-31 09:06:09



2011-01-20 09:48:00

2011-01-20 09:48:00



2010-06-26 01:29:39

2010-06-26 01:29:39













Actual result:
--------------




2010-01-31 09:06:09

2010-01-31 09:01:09



2011-01-20 09:48:00

2011-01-20 09:01:00



2010-06-26 01:29:39

2010-06-26 01:06:39








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



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

Reply via email to