Files.SetDateTime

Top  Previous  Next

 

Syntax

function Files.SetDateTime(FileName: string; NewDateTime: datetime): integer

 

Alternative Names

ibec_SetFileDateTime

 

Description

Modifies the file timestamp of the file identifier by FileName to the new value given in NewDateTime. This function returns zero on success and an error code otherwise, and you can use Shell.GetLastError or Shell.GetLastErrorMessage for more information.

 

See also

Files.GetAttr
Files.GetDateTime

 

Example

execute udsblock 

as

declare variable dt timestamp;

begin

  /* change to a file you want to check */

  fn = 'c:\pagefile.sys';

  

  dt = Files.GetDateTime(fn); 

  GUI.ShowMessage('Last change to this file: ' || dt);

 

  /* this will fail if the file is still "pagefile.sys" */

  errcode = Files.SetDateTime(fn, Util.Now());

 

  if errcode <> 0 

  then GUI.ShowMessage(Shell.GetLastErrorMessage());

  

  dt = Files.GetDateTime(fn); 

  GUI.ShowMessage('Last change to this file: ' || dt);

end