is there any easy way in the api that can do this already?
making it on my own with FileTimeToSystemTime and then putting all the vars in a string is kinda problem matic
Printable View
is there any easy way in the api that can do this already?
making it on my own with FileTimeToSystemTime and then putting all the vars in a string is kinda problem matic
You could use sprintf or StringCchPrintf(). Here is an example from MSDN:
Code:BOOL GetLastWriteTime(HANDLE hFile, LPTSTR lpszString, DWORD dwSize)
{
FILETIME ftCreate, ftAccess, ftWrite;
SYSTEMTIME stUTC, stLocal;
DWORD dwRet;
// Retrieve the file times for the file.
if (!GetFileTime(hFile, &ftCreate, &ftAccess, &ftWrite))
return FALSE;
// Convert the last-write time to local time.
FileTimeToSystemTime(&ftWrite, &stUTC);
SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);
// Build a string showing the date and time.
dwRet = StringCchPrintf(lpszString, dwSize,
TEXT("%02d/%02d/%d %02d:%02d"),
stLocal.wMonth, stLocal.wDay, stLocal.wYear,
stLocal.wHour, stLocal.wMinute);
if( S_OK == dwRet )
return TRUE;
else return FALSE;
}
except its not a date its a number of how many time has passed past.