Change System.DateModified format on Windows Search

前端 未结 1 1999
梦毁少年i
梦毁少年i 2021-01-23 17:15

I\'m using Windows Indexing search together with PHP to search inside thousands of files.

I got it working by using the PHP COM class:

$conn = new COM(\"         


        
相关标签:
1条回答
  • 2021-01-23 18:01

    You can convert a VT_DATE object into a UNIX timestamp with variant_date_to_timestamp and then format it with date, this should work regardless of the date format in the control panel.

    $format = "Y-m-d";
    $object = $recordset->Fields->Item("System.DateModified")->Value;
    $timestamp = variant_date_to_timestamp($object);
    echo date($format, $timestamp) . "\n";
    
    0 讨论(0)
提交回复
热议问题