Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing a file's timestamp
Message
From
02/12/1999 16:43:02
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00298172
Message ID:
00298186
Views:
12
This message has been marked as the solution to the initial question of the thread.
Hi Byran,

>How can I change a file's timestamp programatically?

Here's a post from Erik Moore:
**************
You can do this with the FoxTools Touch function. Here is some code I put together recently to do exactly that.
FUNCTION SetTimeStamp
	LPARA tcFileName, ttNewTimeStamp
	LOCAL loRegistry
	SET PROC TO clsheap ADDI
	SET LIBRARY TO "foxtools.fll" ADDI
	oRegistry = CREATEOBJECT("Registry")
	lnTimeZoneOffsetMinutes = DWORDToNum(oRegistry.GetStringValue(oRegistry.hkey_Local_Machine, ;
			"SYSTEM\CurrentControlSet\Control\TimeZoneInformation", "ActiveTimeBias", ""))
	lnOffsetSeconds = lnTimeZoneOffsetMinutes * 60
	
	ttNewTimeStamp = ttNewTimeStamp + lnOffsetSeconds
	RELEASE oRegistry
	IF FILE(tcFileName)
		=FoxTouch(tcFileName, YEAR(ttNewTimeStamp), MONTH(ttNewTimeStamp), DAY(ttNewTimeStamp), ;
							HOUR(ttNewTimeStamp), MINUTE(ttNewTimeStamp), SEC(ttNewTimeStamp))
		RETURN .T.
	ELSE
		RETURN .F.
	ENDIF
ENDFUNC
This function uses my registry class to get the TimeZone offset from the registry, and Ed Rauh's CLSHeap to translate the DWORD offset value to a Visual FoxPro numeric.

You can adjust the code to fit your needs.
Previous
Reply
Map
View

Click here to load this message in the networking platform