Get System Date





QuickBasic


' DOS 1+ - GET SYSTEM DATE

'$INCLUDE: 'qb.bi'

DIM inregs  AS RegTypeX
DIM outregs AS RegTypeX

inregs.AX = &H2A00

' DOS interrupt with sub-function &H2A

CALL InterruptX(&H21, inregs, outregs)

' CX = year (1980-2099)
DIM Year AS INTEGER
Year = outregs.CX

' DH = month
DIM Month AS INTEGER
Month = outregs.DX \ 256

' DL = day
DIM Day AS INTEGER
Day = outregs.DX AND 255

' ---DOS 1.10+---
' AL = day of week (00h=Sunday)
DIM DayOfWeek AS INTEGER
DayOfWeek = outregs.AX AND 255

PRINT "Year:"; STR$(Year)
PRINT "Month:"; STR$(Month)
PRINT "Day:"; STR$(Day)
PRINT "DayOfWeek:"; STR$(DayOfWeek)