News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

get system date

Started by Anusha, March 15, 2013, 02:37:47 AM

Previous topic - Next topic

Anusha

Can anyone give the program code to get system date using masm

or the code for the same in assembly language

qWord

see GetSystemTime():
include \masm32\include\masm32rt.inc
.code
main proc
LOCAl systime:SYSTEMTIME
;...
invoke GetSystemTime,ADDR systime
;...
exit

main endp
end main
MREAL macros - when you need floating point arithmetic while assembling!

herge


Hi anu_245:


http://masm32.com/board/index.php?topic=1300.msg16253#msg16253


We do the date and Time for Germany [above]


; REM SHOWTIME.ASM  Wednesday, September 24, 2008 2:30 PM
; by herge - Show System Date & Time
include \masm32\include\masm32rt.inc
.data
stm  SYSTEMTIME<>
    org stm; Must be eight words
wYear dw 0
wMonth dw 0
wToDay dw 0 ; Sunday 0 to Saturday 6
wDay    dw 0
wHour   dw 0
wMinute dw 0
wSecond dw 0
wKsecond dw 0
date_buf   db 50 dup (32)
time_buf   db 20 dup (32)
           db 0
dateformat  db " dddd, MMMM, dd, yyyy", 0
timeformat db "hh:mm:ss tt",0
.code
Start:
;  invoke   GetLocalTime, addr stm
;  invoke   GetDateFormat, 0, 0, \
;           ADDR stm, ADDR dateformat, ADDR date_buf, 50
   invoke   GetDateFormat, 0, 0, \
            0, ADDR dateformat, ADDR date_buf, 50
   mov   ecx, offset date_buf
   add   ecx, eax; add length returned by GetDateFormat
   mov   byte ptr [ecx-1], " " ;replace null with space
   invoke   GetTimeFormat, 0, 0, \
            0, ADDR timeformat, ecx, 20
   invoke   MessageBox, 0, addr date_buf, addr date_buf, MB_OK
   invoke ExitProcess, 0
end Start



Above your local Time.

Enjoy!
Regards herge
Read "Slow Death by Rubber Duck"
for chemical Laughs.