PDA

Click to See Complete Forum and Search --> : File creation date


bob323
Jan 10th, 2002, 12:59 PM
I am trying to get the date that a file was created into a character array by using the windows api I have been doing the following:

static HANDLE h;
WIN32_FIND_DATA wfd;
char creation [64];

h = FindFirstFile ("myfile.c", &wfd);
sprintf(creation, "%i",wfd.ftCreationTime.dwHighDateTime);

but all I get is a bunch of garbage, anyone know how I can parse this data up so that it becomes something meaningful?

JoshT
Jan 10th, 2002, 01:44 PM
Use this function:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/time_8cdh.asp

Chris
Jan 10th, 2002, 06:54 PM
you got to convert the ftCreationTime value to SYSTEMTIME structure with FileTimeToSystemTime API and don't forget to offet with the bias value that you set in your computer regional setting. This can be obtain with GetTimeZoneInformation API.

regards,
Chris.C