Getting wrong value for variant_date_to_timestamp() function

為{幸葍}努か 提交于 2019-12-13 01:20:30

问题


In relation with this question, I'm getting a wrong value for the the modified date when querying the windows ADODB connection for indexing files.

This is the line or the query:

$recordset - > Open("SELECT System.ItemName, System.DateModified FROM  SYSTEMINDEX  WHERE DIRECTORY='file:C:/xxxx/' AND CONTAINS('xxxx')", $conn);

I've getting good results on localhost (php 5.5.6), but not in other servers (php 5.5.8). I'm getting the wrong timestamp value and therefore it converts it into a wrong date when I use PHP functions to create my customized format:

date_default_timezone_set(ini_get('date.timezone'));

$date = $recordset->Fields->Item("System.DateModified")->Value;
$timestamp = variant_date_to_timestamp($date);  //getting a wrong date here

$file['date'] => date('d-M-Y H:i:s', $timestamp);

There's a different of some hours between the expected result and the result I'm getting. (2 hours)

It seems to be related with the variant_date_to_timestamp function of PHP. I've already set the proper date.timezone in the php.ini file and added the date_default_timezone_set call before calling variant_date_to_timestamp.

I'm using PHP 5.5.8.

I've found a similar problem/bug commented on 2004. It talks about the two hours difference as well. I find it difficult to believe it hasn't been solved yet.

来源:https://stackoverflow.com/questions/23059452/getting-wrong-value-for-variant-date-to-timestamp-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!