@ECHO OFF
:: We set the name of the file whose date we want to check.
:: Here, for demo purposes, we check on AUTOEXEC.BAT
SET F=C:\AUTOEXEC.BAT
:: get date/time stamp, in seconds, from the file
FDATE /FF /Osecond# /If /A%f% /P"set ftime=" > junk.bat
call junk.bat
:: get date/time, in seconds, of the current time
FDATE /FF /Osecond# /P"set ctime=" > junk.bat
call junk.bat
:: get the difference
Fdate /f#dif /a%ctime% /b%ftime% /P"set tdiff=">junk.bat
call junk.bat
:: see if the difference is greater than 3600 seconds (1 hour)
Fdate /F#comp /a%tdiff% /b3600 >nul
:: if difference is greater than 3600 seconds, we have a problem
if errorlevel 103 goto bad_time
:: else..
goto ok_time
:bad_time
:: PUT YOUR PROBLEM-HANDLING CODE HERE
:: For demo purposes, we just display a message and pause.
:: Steve would have put code here to send a message to his pager
echo File %F% has not been updated on time
echo Time difference is %tdiff% seconds
pause
goto endit
:ok_time
:: For demo purposes, we display a message and pause.
:: In an actual batch file, you'd probably do nothing at all.
echo Time difference is %tdiff% seconds
echo No problem!
pause
:: ... and fall through to the ":endit" label
:endit
:: cleanup
set ctime=
set ftime=
set tdiff=
set f=
del junk.bat