January 1, 2005

WinTask - GetLocalTime

'
' GetLocalTime
'
' Return System's Date and Time information
'
' Author: Joe Strazzere
'

dim pointer as unsigned
dim ptr2 as unsigned

pointer=allocate(255)
wdir$="                "
ret=PokeString(pointer,wdir$,0)
a=External("kernel32","GetLocalTime",pointer)

ptr2=pointer+0
sysyr   = peekinteger(ptr2,2)
ptr2 = pointer + 2
sysmo   = peekinteger(ptr2,2)
ptr2 = pointer + 4
sysdow  = peekinteger(ptr2,2)
ptr2 = pointer + 6
sysday  = peekinteger(ptr2,2)
ptr2 = pointer + 8
syshr   = peekinteger(ptr2,2)
ptr2 = pointer + 10
sysmin  = peekinteger(ptr2,2)
ptr2 = pointer + 12
syssec  = peekinteger(ptr2,2)
ptr2 = pointer + 14
sysmil  = peekinteger(ptr2,2)
msgbox("Year = "+str$(sysyr),,"GetLocalTime")
msgbox("Month = "+str$(sysmo),,"GetLocalTime")
msgbox("Day of Week = "+str$(sysdow),,"GetLocalTime")
msgbox("Day = "+str$(sysday),,"GetLocalTime")
msgbox("Hour = "+str$(syshr),,"GetLocalTime")
msgbox("Min = "+str$(sysmin),,"GetLocalTime")
msgbox("Sec = "+str$(syssec),,"GetLocalTime")
msgbox("Mil = "+str$(sysmil),,"GetLocalTime")