I needed to set a file Date / Time stamp back to what it was before I added a barcode to a pdf file.
I opted to use FoxTouch() which is in the FoxTools.fll
This has one niggle, it adopts a 'bias' when you set the time stamp, so in the UK right now
if I used FoxTouch to save the file at 17:48, it would actually set it to 18:48.
I tried to get the bias from the TimeZoneInformation, but could not get it to work at all.
So, I reasoned that I could calculate it from the new file time stamp anyway...
Thus, all you have to do is test to see if the time you got was different to the time you hoped for.
If it is, calculate how far out it is and deduct that from the time you want and then set it again.
Regards
Griff
Keep [Smile]ing
There are 10 kinds of people in the world, those who understand binary and those who don't.
I opted to use FoxTouch() which is in the FoxTools.fll
This has one niggle, it adopts a 'bias' when you set the time stamp, so in the UK right now
if I used FoxTouch to save the file at 17:48, it would actually set it to 18:48.
I tried to get the bias from the TimeZoneInformation, but could not get it to work at all.
So, I reasoned that I could calculate it from the new file time stamp anyway...
Thus, all you have to do is test to see if the time you got was different to the time you hoped for.
If it is, calculate how far out it is and deduct that from the time you want and then set it again.
Code:
FUNCTION MyTouch
PARAMETERS m.FileName,m.WasFTime
PRIVATE m.FileName,M.WasFTime, M.NowFDate, M.NowFTime, M.TimeDiff
** Set the hours format to 24HR
SET HOURS TO 24
** Open up the FOXTOOLS - in the same folder as the executable (because the system puts it there if it isn't already)
SET LIBRARY TO ("foxtools") additive
** RESET THE TIME AND DATE BACK...
=FOXTOUCH( m.FileName, YEAR(m.WasFTime),MONTH(m.WasFTime), DAY(m.WasFTime), HOUR(m.WasFTime), MINUTE(m.WasFTime), SEC(m.WasFTime))
** FOXTOUCH INCLUDES A 'BIAS' THAT WILL PUT THE TIME WRONG... SO IF WE WORK OUT HOW FAR OUT IT IS WE CAN RETOUCH AND CORRECT
m.NowFDATE = FDATE(m.FileName)
m.NowFTIME = FTIME(m.FileName)
m.NowFTIME = CTOT(STR(YEAR(m.NowFDATE),4,0)+"-"+alltrim(STR(MONTH(m.NowFDATE),2,0))+"-"+alltrim(STR(Day(m.NowFDATE),2,0))+"T"+m.NowFTIME)
IF M.NOWFTIME <> M.WASFTIME
M.TIMEDIFF = M.NOWFTIME - M.WASFTIME
M.WASFTIME = M.WASFTIME - M.TIMEDIFF
=FOXTOUCH( m.FileName, YEAR(m.WasFTIME),MONTH(m.WasFTIME), DAY(m.WasFTIME), HOUR(m.WasFTIME), MINUTE(m.WasFTIME), SEC(m.WasFTIME))
ENDIF
RELEASE LIBRARY foxtools
RETURN(.T.)
Regards
Griff
Keep [Smile]ing
There are 10 kinds of people in the world, those who understand binary and those who don't.