Posts: 25
Threads: 12
Joined: Aug 2012
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
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)
Posts: 12,087
Threads: 142
Joined: Dec 2002
Macro
Macro1821
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"
Posts: 25
Threads: 12
Joined: Aug 2012
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.