> Hi Anders,
>
> that's some neat code, but I don't think it will handle time differences of more than a day.
>
> >
> >
lnSeconds= datetime2 - datetime1
> > ltDiffTime = DTOT(DATE()) + lnSeconds
> > ? TTOC(ltDifftime,2 )
> > You can put those three lines of code into a single line
> >
? TTOC(DTOT(DATE())+(datetime2 - datetime1),2)
> > How the time is displayed depends on
SET HOURS 24|12 and
SET SECONDS ON|OFF.
> > If the difference is more than 24 hours, which is 24*60*60 seconds, you must calculate the differenc in days too:
> > The difference in days:
> >
? TTOD(datetime2)-TTOD(datetime1),'days'
> > If you need to separate out the hours, minutes and seconds, VFP is there for you:
> >
ltTime = DTOT(DATE())+(datetime2 - datetime1)
> > ? HOUR(ltTime),'hours',MINUTE(ltTime),'minutes',SEC(ltTime),'seconds'
> > -Anders
>
>
>
> Frank.
>
> Frank Cazabon
> Samaan Systems Ltd.
>
www.SamaanSystems.com/Hi Frank,
Well, that's noted in my post.
> If the difference is more than 24 hours, which is 24*60*60 seconds, you must calculate the differenc in days too:
> The difference in days:
>
? TTOD(datetime2)-TTOD(datetime1),'days'
This difference can also by multiplied by 24 and added to the hours. An exercise for the reader :-)
-Anders