1. Time Difference Calculation

I'm trying to calculate the difference in seconds from the current time and 12:00 AM. Anyone have code to do this?

3. Re: Time Difference Calculation

Thanks John. The DiffTime() function is what I'm after but the attachment is not there. I went to the ameliortech web site and saw the function listed but there is no link to click to download it. I have a e-mail in to David Reed to see if he still has it to send to me.

4. Re: Time Difference Calculation

DiffDateTime is part of SilkTest and can be used to do the same thing. But, since I have a few minutes, here ya go....

</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">[-] INTEGER SecondsSinceMidnight ()
[ ] INTEGER iRtn
[ ] DATETIME dNow
[ ] DATETIME dMidnight
[ ] INTEGER iDay, iMonth, iYear
[ ] INTEGER iHours, iMinutes, iSeconds
[ ]
[ ] // what time is it now?
[ ] dNow = GetDateTime ()
[ ]
[ ] // figure out the day, month, and year
[ ] iDay = GetDateTimePart (dNow, DTP_DAY)
[ ] iMonth = GetDateTimePart (dNow, DTP_MONTH)
[ ] iYear = GetDateTimePart (dNow, DTP_YEAR)
[ ]
[ ] // without passing in the time elements, you get midnight
[ ] dMidnight = MakeDateTime (iYear, iMonth, iDay)
[ ]
[ ] // calc the difference (should all be hours, minutes and seconds
[ ] iRtn = DiffDateTime (dNow, dMidnight, iHours, iMinutes, iSeconds)
[ ]
[ ] // now put it all together
[ ] iRtn = iSeconds + (60 * iMinutes) + (3600 * iHours)
[ ]
[ ] // and we're outa here
[ ] return iRtn</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">I hope this helps.

- Dave

5. Re: Time Difference Calculation

Thanks Dave.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.