Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Timeleft  (Read 3289 times)

0 Members and 1 Guest are viewing this topic.

jen140

  • Guest
Timeleft
« on: November 03, 2005, 09:45:13 AM »
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 ?

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Timeleft
« Reply #1 on: November 03, 2005, 01:58:23 PM »
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.

8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

jen140

  • Guest
Re: Timeleft
« Reply #2 on: November 03, 2005, 02:36:50 PM »
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 ?

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Timeleft
« Reply #3 on: November 03, 2005, 06:57:20 PM »
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.

:-/
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

jen140

  • Guest
Re: Timeleft
« Reply #4 on: November 04, 2005, 01:08:51 AM »
ty anyway.

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Timeleft
« Reply #5 on: November 04, 2005, 06:50:25 AM »
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. 8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

jen140

  • Guest
Re: Timeleft
« Reply #6 on: November 06, 2005, 05:50:30 AM »
Ty a lot !