简体   繁体   中英

PHP DateTime Error with huge amount of Data

I've got a Problem with DateTime in PHP. In my Testcase I have 10.000 Rows that are pulled from a MySQL InnoDB Database. This works fine, as my local development is running on a SSD and it takes about 10 Seconds to pull all Rows. As ORM in PHP I'm using Propel. (because I like the Getter and Setter, anyway). The Problem is that after a few rows, approx at the 50 row, the calculation gets more and more off. I'm trying to Display a "due time".

The Code looks like this and it's working, until the 50 row.

$dateTime = $message->getReceivedat ();
$dateinterval = new DateInterval("PT15M");
$dateTime->add ($dateinterval);
echo $dateTime->format ('d-m-Y H:i:s');

after the 50 row, it gets more and more off. At the 10.000 i got + 1 Day and 4 hours. So maybe it's a buffer Error from InnoDB, or Propel to not give me the right Dates.

Here are the values i get.

|ReceivedAt | DueTo |

24-07-2015 16:11:24 | 24-07-2015 16:26:24 The first row
24-07-2015 16:11:46 | 24-07-2015 16:28:46 The second one (is already of by 2 minutes)
29-07-2015 15:11:11 | 29-07-2015 16:14:11 The last row is this one.

I'm developing locally on a Windows 8.1 x64, XAMPP (newest Version), Propel (newest Version), 24GB DDR3 RAM, and Intel I7-4790, and the Database is on a 256gb Samsung SSD.

您正在从数据库中检索的数据不正确,但是没有更多输入,我无法向您解释错误是什么。

i got it, it was a formatting error with the "echo" in php. I did use H:II:s instead of H:i:s. But it's interesting that the echo showed the wrong time and was off completely.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM