I dug down to the byte level in the BKPRMSTR table.
At byte offset 0639 hex, the Birthdate is stored in the 4 byte Btrieve DATE format.
For you programming types, it is:
struct
{
Day : char;
Month : char;
Year : short; /* (16bit integer or Small Integer) */
}
Using the Pervasive Function Executor, I read these 4 bytes at offset 0x639:
0x15 0x07 0xEA 0x07
at offset 0x0639 for an employee that has a birthdate of 07/21/26 as shown on the PR-A screen.
Since Anything larger than char is stored '
little endian' (Thanks Intel), we need to switch the last two bytes so that we can convert the hex year to decimal:
0x15 0x07 0x07 0xEA
These 4 bytes convert as follows:
0x15 = 21 - Day
0x07 = 7 - Month
0x07EA = 2026 - Year
So, Pervasive has the ability to store from year -32767 to 32767 (signed 16bit Integer).
According to the Pervasive sqlref manual, section 'Pervasive.SQL Supported Data Types'
they support from year 0001 to year 9999.
What this means is that since the PR-A screen only allows us to enter a 2 digit year, either the PR-A application or TAS is deciding that '26' means '2026' and is storing that value into the Btrieve record.
The simple Crystal function shown above should always work for now, given this behavior.
So there you have it, everything you always didn't want to know about the Pervasive 4 byte DATE format!!