Windows File Date Time Attributes
Posted: Thu Jan 06, 2005 3:23 am
How can I get the Date and Time Attributes of a Windows file ?
A short text to describe your forum
http://dsxchange.com./
Code: Select all
Rem **************************************************************************************
Rem ** Routine to return the Date & Time of a DOS file as format "DD-MM-YYYY HH:MM:SS" **
Rem ** The single lines of the program can be combined for efficiency, they have been **
Rem ** separated for clarity. The date format that is output by dos is installation **
Rem ** dependant, on my system it displays as MDY but that changes according to Windows **
Rem ** locale settings. **
Rem ** Routine input parameter is "FileName" and needs the fully qualified DOS pathname **
Rem ** to the file. **
Rem **************************************************************************************
CALL DSExecute("NT","DIR ":FileName,StringOutput,ErrorCode) ;** Get the DOS info
TempString = TRIM(StringOutput<6>) ;** the 6th line has the details
WorkDate = ICONV(FIELD(TempString," ",1),"D4/MDY") ;** convert date to internal fmt
WorkTime = ICONV(FIELD(TempString," ",2),"MTS") ;** convert time to internal fmt
Ans = OCONV(WorkDate,"D4-DMY[2,2,4]") ;** Create output date part of string
Ans := " ":OCONV(WorkTime,"MTS") ;** Create output time part of string