![]() | ![]() | ![]() | ![]() | ![]() |
This is a rexx function provided by PPWIZARD. This routine (like all PPWIZARD extensions) can be used with any operating system supported by PPWIZARD.
This function takes a single parameter (the name of the file we wish the date/time imformation of).
If successful this routine returns a decimal number of the form "YYYYMMDDHHMMSS". The returned number can be compared with others to determine the newest file etc. You can substr() etc to transform the result into whatever format you desire.
If the call fails (for example if the specified file does not exist) then a WARNING is generated and a return code of "-1" is returned.
You can determine the day of the week for the file using the BaseDate routine.
The following example shows how the date/time of a file can be retrieved and converted into whatever format you wish. Note that in the following macro I was careful not to redefine any variables and that a file not found is treated as a fatal error.
#define GetFileDateTime \ #evaluate TmpDateTime ^GetFileTimeStamp("{$File}");^ \ #if <$TmpDateTime> = -1 \ #error ^The file "{$File}" was not found.^ \ #elseif \ #evaluate TmpDate ^substr('<$TmpDateTime>', 7, 2) || '/' || substr('<$TmpDateTime>', 5, 2) || '/' || left('<$TmpDateTime>', 4)^ \ #evaluate TmpHH ^substr('<$TmpDateTime>', 9, 2)^ \ #if <$TmpHH> < 12 \ #define TmpAmPm am \ #elseif \ #define TmpAmPm pm \ #endif \ #if <$TmpHH> > 12 \ #evaluate TmpHHAmPm ^<$TmpHH> - 12^ \ #elseif \ #evaluate TmpHHAmPm ^<$TmpHH>^ \ #endif \ #evaluate TmpTime ^"<$TmpHHAmPm><$colon>" || substr('<$TmpDateTime>', 11, 2) || '<$colon>' || substr('<$TmpDateTime>', 13, 2) || '<$TmpAmPm>'^ \ \ ;--- Output the information ("DD/MM/YYYY at HH<$colon>MM<$colon>SSam") --- \ <$TmpDate> at <$TmpTime> \ #undef TmpDate \ #undef TmpTime \ #undef TmpHH \ #undef TmpHHAmPm \ #undef TmpAmPm \ #endif \ #undef TmpDateTime ;--- Use my macro to get a timestamp ------------------------------------- <P>The date/time stamp of "C:\AUTOEXEC.BAT" is "<$GetFileDateTime File="C:\AUTOEXEC.BAT">".
![]() | ![]() | ![]() | ![]() | ![]() |