without changing the SetFDateTime() sources it´s not possible to set the timeStamp of a file to "00:00:00". When you run this sample in VO the Filedate is as expected the current date - 2 , but the Filetime is set to the current system time.
Code: Select all
SetFDateTime ( "C:xyzxyz.txt" , Today() - 2 , "00:00:00" )
Code: Select all
IF Secs ( cTimeStamp ) == 0
cTimeStamp := Time()
ENDIF
- To be compatible with VO i created two overloads.
Code: Select all
FUNCTION SetFDateTime ( cFile AS STRING , dStamp AS DATE , cTimeStamp AS STRING ) AS LOGIC
RETURN SetFDateTime ( cFile , dStamp , cTimeStamp , FALSE )
FUNCTION SetFDateTime ( cFile AS STRING , dStamp AS DATE , cTimeStamp AS STRING , lAllowZeroTimeStamp AS LOGIC ) AS LOGIC
LOCAL lOk AS LOGIC
TRY
lOk := TRUE
// VO behaviour if a NULL_DATE is passed
IF dStamp == NULL_DATE
dStamp := Today()
ENDIF
IF ! lAllowZeroTimeStamp
// VO behaviour if the TimeStamp "00:00:00" is passed
IF Secs ( cTimeStamp ) == 0
cTimeStamp := Time()
ENDIF
ENDIF
VAR ts := TimeSpan.Parse( cTimeStamp )
File.SetLastWriteTime( cFile ,;
DateTime { (INT) Year ( dStamp ) , (INT) Month ( dStamp ) , (INT) Day( dStamp ) ,;
ts:hours , ts:minutes , ts:Seconds } )
CATCH
lOk := FALSE
END TRY
RETURN lOk
Code: Select all
FUNCTION SetFDateTime ( cFile AS STRING , dStamp AS DATE , cTimeStamp AS STRING , lAllowZeroTimeStamp := FALSE AS LOGIC ) AS LOGIC
regards
Karl-Heinz