Hi folks,
I'm trying to read some records from an SQL database. One of the fields is an integer field though the data corresponds to a given date and time stamp.
When the data is viewed through the vendors application it uses C++ to convert the integer to a legible date and time. The C++ code is as folows;
CTime ExpandTime(int time)
{
WORD year;
BYTE hour,min,sec,month,date;
sec = (BYTE) (time & 0x3F);
time >>= 6;
min = (BYTE) (time & 0x3F);
time >>= 6;
hour = (BYTE) (time & 0x1F);
time >>= 5;
date = (BYTE) (time & 0x1F) + 1;
time >>= 5;
month = (BYTE) (time & 0x0F) + 1;
time >>= 4;
year = (WORD) (time & 0x3F) + 1996;
CTime t(year,month,date,hour,min,sec);
return t;
}
For example, 609537500 is converted to 11-Feb-2005 12:55.28
Does anyone know if and how I could use VBA to convert this integer to a legible date field? I'm trying to build an Access front to this SQL db to provide tailored reports. The third party application has limited reporting options.
Thanks,
Dave
I'm trying to read some records from an SQL database. One of the fields is an integer field though the data corresponds to a given date and time stamp.
When the data is viewed through the vendors application it uses C++ to convert the integer to a legible date and time. The C++ code is as folows;
CTime ExpandTime(int time)
{
WORD year;
BYTE hour,min,sec,month,date;
sec = (BYTE) (time & 0x3F);
time >>= 6;
min = (BYTE) (time & 0x3F);
time >>= 6;
hour = (BYTE) (time & 0x1F);
time >>= 5;
date = (BYTE) (time & 0x1F) + 1;
time >>= 5;
month = (BYTE) (time & 0x0F) + 1;
time >>= 4;
year = (WORD) (time & 0x3F) + 1996;
CTime t(year,month,date,hour,min,sec);
return t;
}
For example, 609537500 is converted to 11-Feb-2005 12:55.28
Does anyone know if and how I could use VBA to convert this integer to a legible date field? I'm trying to build an Access front to this SQL db to provide tailored reports. The third party application has limited reporting options.
Thanks,
Dave