BCX Console Demonstration Program S74.bas

 IF COMMAND$ = "" THEN
   PRINT "Usage: S74 FileName.Ext"
   END
 END IF
 
 PRINT COMMAND$, "  ", FileDateTime$(COMMAND$)
 
 FUNCTION FileDateTime$(Filenam$)
   LOCAL  fd  AS WIN32_FIND_DATA
   LOCAL  st  AS SYSTEMTIME
   LOCAL  fh  AS HWND
   LOCAL  Temp$
   LOCAL  Text$
   Text$  = Filenam$
   fh     = FindFirstFile(Text$, &fd)
 
   IF fh  = INVALID_HANDLE_VALUE THEN
     EXIT FUNCTION
   END IF
   FindClose(&fh)
   FileTimeToLocalFileTime(&fd.ftLastWriteTime, &fd.ftLastWriteTime)
   FileTimeToSystemTime(&fd.ftLastWriteTime, &st)
   GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, Text$, 255)
   Temp$ = Text$
   GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, Text$, 255)
   FUNCTION = Temp$ & "  " & Text$
 END FUNCTION