Int 21H [1.0] Function 2AH (42) Get date

Obtains the system day of the month, day of the week, month, and year.

Call with:

AH = 2AH

Returns:

CX = year (1980 through 2099)

DH = month (1 through 12)

DL = day (1 through 31)

Under MS-DOS versions 1.1 and later

AL = day of the week (0 = Sunday, 1 = Monday, etc.)

Notes:

This function's register format is the same as that required for Int 21H Function 2BH (Set Date).

This function can be used together with Int 21H Function 2BH to find the day of the week for an arbitrary date. The current date is first obtained with Function 2AH and saved. The date of interest is then set with Function 2BH, and the day of the week for that date is obtained with a subsequent call to Function 2AH. Finally, the current date is restored with an additional call to Function 2BH, using the values obtained with the original Function 2AH call.

Example:

Obtain the current date and save its components in the variables year, day, and month.

year dw 0

month db 0

day db 0

.

.

.

mov ah,2ah ; function number

int 21h ; transfer to MS-DOS

mov year,cx ; save year (word)

mov month,dh ; save month (byte)

mov day,dl ; save day (byte)

.

.

.