Get file modify date with Local time

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
yemanqitipo
Posts: 11
Joined: Sat Dec 17, 2022 9:02 am

Get file modify date with Local time

Post by yemanqitipo »

Hi,
When calling Everything_GetResultDateModified in my program, i got the modify date of file in UTC。
Is there a modifer or option to get the local time.


void CustomSearch(std::wstring regexStr, bool regexFlag) {
DWORD i;
const int MAX_TIME_LEN = 60;
char strTime[MAX_TIME_LEN] = { 0x00 };

Everything_SetSearchW(regexStr.c_str());
Everything_SetRequestFlags(EVERYTHING_REQUEST_FILE_NAME
| EVERYTHING_REQUEST_PATH
| EVERYTHING_REQUEST_DATE_MODIFIED);

// execute the query
Everything_QueryW(true);

int numResults = Everything_GetNumResults();
for (i = 0; i < numResults; i++)
{
wchar_t buf[MAX_PATH_LEN] = { 0x00 };
Everything_GetResultFullPathNameW(i, buf, MAX_PATH_LEN);

FILETIME dateModified;
SYSTEMTIME st;
bool ret = Everything_GetResultDateModified(i, &dateModified);
DWORD dwLastError = Everything_GetLastError();
if (dwLastError == EVERYTHING_ERROR_INVALIDCALL)
{
continue;
}
FileTimeToSystemTime(&dateModified, &st);
sprintf(strTime, "%d/%d/%d %02d:%02d:%02d",
st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
}

}


I know I can call FileTimeToLocalFileTime in my program. But if the search result count is an huge number, the performance would be slow down.
So is there a modifer or option to get the local time?
void
Developer
Posts: 16773
Joined: Fri Oct 16, 2009 11:31 pm

Re: Get file modify date with Local time

Post by void »

No, sorry.

Everything stores date modified as a FILETIME internally.
A FILETIME is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).

Use FileTimeToLocalFileTime to convert to a local time.
yemanqitipo
Posts: 11
Joined: Sat Dec 17, 2022 9:02 am

Re: Get file modify date with Local time

Post by yemanqitipo »

Got it. Thank you for reply.
Post Reply