1.

Solve : Timeleft?

Answer»

I just wnt to know is there a possibility to create 1 bat file that would show time what left to 6 hours ,and that could be counting down ?Quote

I just wnt to know is there a possibility to create 1 bat file that would show time what left to 6 hours ,and that could be counting down ?


I really don't understand your request but in any case batch files don't do date or time calculations.

Batch language is not a programming language and as SCRIPTING language is pretty far down in it's usefulness.

Supose that now is 22:20 PM 3.7.2005 what i want is to know how much timeleft untill maybe 2hours am of 4.7.2005 ,so is there any .bat to do it ? or maybe vb script ?VBScript does not have the functions needed for this although JScript has some that look promising. You might try Google. Sometimes the strangest things popup.

:-/ty anyway.I MAY have been a little HASTY in saying a script couldn't do this. Sometimes I overlook the brute force method.

Code: [Select]
dtmSec = DateDiff("s", Now, "11/04/2005 05:00:00 PM")
dtmMin = dtmSec / 60
dtmHours = dtmMin / 60
dtmDays = dtmHours / 24

lngFullDays = Int(dtmDays)
lngFullHours = Int(dtmHours)
lngFullMin = Int(dtmMin)

intHours = Int((dtmDays - lngFullDays) * 24)
intMin = Int((dtmHours - lngFullHours) * 60)
intSec = CInt((dtmMin - lngFullMin) * 60)

wscript.echo "Days: " & lngFullDays & " Hours: " & intHours & " Minutes: " & intMin & " Seconds: " & intSec


Note: This is pretty crude. It needs to be run within a loop and to pretty it up, a GUI would be nice so you can enter the end time. A HTA where you can combine Script with HTML (no browser needed) would be even better. I'll leave that to you but the code as WRITTEN will give accurate results.

Good luck. Ty a lot !


Discussion

No Comment Found