Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
time difference of file versus the current time.
#1
I am working on a project whre i need to manually edit the contents of a file periodically. I was trying to calculate the differnce between .TimeModified and .FromComputerTime.
I got this far but not sure how to return the difference in minutes or hours?

Macro Test
Code:
Copy      Help
Dir d
if d.dir("C:\mjinstalls\ccalertip.txt" 0) ;;if exists
,DATE ft=d.TimeModified
out ft
DateTime ct
ct.FromComputerTime
out ct.ToStr(4)
#2
Macro Macro1821
Code:
Copy      Help
Dir d
if d.dir("C:\windows\*.txt" 0) ;;if exists
,DateTime ft=d.TimeModified ;;this function returns value in FILETIME format, which is also used by DateTime
out ft.ToStr(4)
DateTime ct
ct.FromComputerTime
out ct.ToStr(4)
long diff=ct-ft
out TimeSpanToStr(diff)
out F"{diff/10000000/60} minutes"
#3
Thanks Gintara exactly what I needed. The TimeSpanToStr is one thing I was missing. Doubt I would have figured out the diff/1000000/60 either.


Forum Jump:


Users browsing this thread: 1 Guest(s)