Function 57h (87)        Get or Set a File's Date and Time

Gets or sets a file's date and time.

To get a file's date and time:

On entry: AH 57h
AL 00h
BX File handle

Returns: AX Error code if CF is set
CX Time
DX Date

To set a file's date and time:

On entry: AH 57h
AL 01h
BX File handle
CX Time
DX Date

Returns: AX Error code if CF is set

Error codes: 1 Invalid function number in AL
6 Invalid handle

──────────────────────────────────────────────────────────────────────────

Function 57h gets or sets the date and time for a file that has been
opened with a file handle (such as with function 3Dh).

The date and time are defined as follows:

CX = Time = Hour * 2048 + Minute * 32 + Second / 2
DX = Date = (Year - 1980) * 512 + Month * 32 + Day

CX Bits Description
11 - 15 Hours (0..23)
5 - 10 Minutes (0..59)
0 - 4 Seconds/2 (0..30)

DX Bits Description
9 - 15 Year since 1980 (0..119)
5 - 8 Month (1..12)
0 - 4 Day (1..31)

Notes: Contrary to what some DOS documentation says, the
date and time are returned in the conventional
format, with the high-order part in CH and DH and
the low-order part in CL and DL.