leme9 Posted January 30, 2016 Posted January 30, 2016 (edited) Func Sec2Time($nr_sec) $sec2time_hour = Int($nr_sec / 3600) $sec2time_min = Int(($nr_sec - $sec2time_hour * 3600) / 60) $sec2time_sec = $nr_sec - $sec2time_hour * 3600 - $sec2time_min * 60 $sec2time_milli = $nr_sec - $sec2time_hour * 3600 - $sec2time_min * 60 Return StringFormat('%02d:%02d:%02d.%02d', $sec2time_hour, $sec2time_min, $sec2time_sec,$sec2time_milli) EndFunc For $i = 0 to 999999999 ToolTip(Sec2Time($i),0,0) Sleep(100); change Next how to conver number in for loop to time type: "00:00:00.00" => HOUR:MIN:MSEC.MILLISECOND 1Msec = 100 millisecond Edited February 19, 2020 by leme9
water Posted January 30, 2016 Posted January 30, 2016 Something like this? Global $sDisplayTime = "" Global $iTimer = TimerInit() AdlibRegister("Sec2Time", 100) While 1 Sleep(50) ToolTip($sDisplayTime, 0, 0) WEnd Func Sec2Time() Local $iCounter = TimerDiff($iTimer) ; Milliseconds since start of script Local $iTempSec = $iCounter / 1000 ; Seconds since start of script $iHour = Int($iTempSec / 3600) $iMin = Int(($iTempSec - $iHour * 3600) / 60) $iSec = Int($iTempSec - $iHour * 3600 - $iMin * 60) $iMilli = Mod($iCounter, 1000) $sDisplayTime = StringFormat('%02d:%02d:%02d.%03d', $iHour, $iMin, $iSec, $iMilli) EndFunc ;==>Sec2Time leme9 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
leme9 Posted January 31, 2016 Author Posted January 31, 2016 (edited) Thank u bro ! Edited February 19, 2020 by leme9
leme9 Posted January 31, 2016 Author Posted January 31, 2016 (edited) On 1/31/2016 at 12:11 AM, water said: Something like this? Global $sDisplayTime = "" Global $iTimer = TimerInit() AdlibRegister("Sec2Time", 100) While 1 Sleep(50) ToolTip($sDisplayTime, 0, 0) WEnd Func Sec2Time() Local $iCounter = TimerDiff($iTimer) ; Milliseconds since start of script Local $iTempSec = $iCounter / 1000 ; Seconds since start of script $iHour = Int($iTempSec / 3600) $iMin = Int(($iTempSec - $iHour * 3600) / 60) $iSec = Int($iTempSec - $iHour * 3600 - $iMin * 60) $iMilli = Mod($iCounter, 1000) $sDisplayTime = StringFormat('%02d:%02d:%02d.%03d', $iHour, $iMin, $iSec, $iMilli) EndFunc ;==>Sec2Time $iMilli run 1 to 100 Edited February 19, 2020 by leme9
czardas Posted January 31, 2016 Posted January 31, 2016 (edited) Maybe if you modify this line: $sDisplayTime = StringFormat('%02d:%02d:%02d.%01d', $iHour, $iMin, $iSec, $iMilli/100) Edited January 31, 2016 by czardas leme9 1 operator64 ArrayWorkshop
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now