Like Carlos said, you're most likely getting the BCD code. Something like this *might* work provided that you don't want the day of the week too.
Code:
#include <stdio.h>
int main(void)
{
unsigned char cent, year, month, day;
static char *months[] =
{ "Error", "January", "February", "March",
"April", "May", "June", "July", "August",
"September", "October", "November",
"December" };
_asm
{
mov ah,0x4
int 0x1A
mov cent,ch
mov year,cl
mov month,dh
mov day,dl
}
switch(month)
{
case 16: month = 10;
break; /* 10000 BCD October */
case 17: month = 11;
break; /* 10001 BCD November */
case 18: month = 12;
break; /* 10010 BCD December */
default: break;
};
printf("System Date: %s %x, %x%s%x",
months[month], day, cent,
(year > 9 ? "" : "0"), year);
return 0;
}
I *think* that it covers all cases, but you'd have to run through all the combinations to know for sure.