Do UNTIL DATETIME date time

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
The help says YYYY-MM-DD HH:MM:SS is OK but it doesn't work. I only get one iteration.

Code:
v:\> type dodo.bat
echo on
do until datetime 2010-06-01 00:00:00
        delay 1
enddo

v:\> dodo.bat
do until datetime 2010-06-01 00:00:00
delay 1

v:\>
 
#2
And when using a one-token datetime specification involving a variable function, the results are unpredictable. Below, the first two loops work and the third doesn't!

Code:
v:\> type dodo.bat
do until datetime %@eval[%_datetime]
        echo %_time
        delay 1
enddo
echo Done!

do until datetime %@eval[%_datetime+0]
        echo %_time
        delay 1
enddo
echo Done!

do until datetime %@eval[%_datetime+1]
        echo %_time
        delay 1
enddo
echo Done!

v:\> dodo.bat
17:39:08
Done!
17:39:09
Done!
17:39:10
17:39:11
17:39:12
17:39:13
17:39:14
17:39:15
17:39:16
^C

v:\>
 
#3
----- Original Message -----
From: "vefatica" <>
To: <ESFabian@comcast.net>
Sent: 2010. May 30., Sunday 17.44
Subject: RE: [Support-t-2007] Re: Do UNTIL DATETIME date time



> And when using a one-token datetime specification involving a variable
> function, the results are unpredictable. Below, the first two loops work
> and the third doesn't!
>
>
> Code:
> ---------
> v:\> type dodo.bat
> do until datetime %@eval[%_datetime]
> echo %_time
> delay 1
> enddo
> echo Done!
>
> do until datetime %@eval[%_datetime+0]
> echo %_time
> delay 1
> enddo
> echo Done!
>
> do until datetime %@eval[%_datetime+1]
> echo %_time
> delay 1
> enddo
> echo Done!
>
> v:\> dodo.bat
> 17:39:08
> Done!
> 17:39:09
> Done!
> 17:39:10
> 17:39:11
> 17:39:12
> 17:39:13
> 17:39:14
> 17:39:15
> 17:39:16
Vince,
the value of @eval is a floating point number that happens to be an integer,
but not a true "datetime" until its value is converted into a decimal
integer format. Due to its history TCC does not make the sharp distinction
between numeric types and strings that other HLLs do. Did you try to force
the function result into the datetime format?
--
Steve
 
#4
On Sun, 30 May 2010 18:08:16 -0400, Steve Fábián <> wrote:

|Vince,
|the value of @eval is a floating point number that happens to be an integer,
|but not a true "datetime" until its value is converted into a decimal
|integer format. Due to its history TCC does not make the sharp distinction
|between numeric types and strings that other HLLs do. Did you try to force
|the function result into the datetime format?

Steve, @EVAL[] produces a **string**, exactly what's called for.

v:\> echo %_datetime^r^n%@eval[%_datetime+1]
20100530192246
20100530192247
--
- Vince
 
#5
Did anyone confirm that it's broken?

Code:
v:\> type dodo.bat & echo Now: %_date %_time^r^n^r^n & dodo.bat
do until datetime 2010-06-03 10:46:00
        echo %_time
        delay 1
enddo
echo Batchfile done.

Now: 2010-06-03 10:45:50


10:45:50
Batchfile done.
 
#6
It appears broken on my machine using MM-DD HH:MM:SS but works as
advertised using YYYYMMDDHHMMSS

.) Works using compressed time format
D:\>type test.btm %+ echo %_date %_time %+ test.btm
do until datetime 20100603081420
echo %_time
delay 1
enddo
echo Batchfile done.
2010-06-03 08:14:16
08:14:16
08:14:17
08:14:18
08:14:19
Batchfile done.

.) Fails using expanded time format
D:\>type test.btm %+ echo %_date %_time %+ test.btm
do until datetime 2010-06-03 08:15:00
echo %_time
delay 1
enddo
echo Batchfile done.
2010-06-03 08:14:49
08:14:49
Batchfile done.

D:\>
On Thu, Jun 3, 2010 at 7:47 AM, vefatica <> wrote:


> Did anyone confirm that it's broken?
>
>
> Code:
> ---------
> v:\> type dodo.bat & echo Now: %_date %_time^r^n^r^n & dodo.bat
> do until datetime 2010-06-03 10:46:00
> echo %_time
> delay 1
> enddo
> echo Batchfile done.
>
> Now: 2010-06-03 10:45:50
>
>
> 10:45:50
> Batchfile done.
> ---------
>
>
>
>


--
Jim Cook
2010 Sundays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Monday.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,415
40
Albuquerque, NM
prospero.unm.edu
#7
Did anyone confirm that it's broken?

Code:
v:\> type dodo.bat & echo Now: %_date %_time^r^n^r^n & dodo.bat
do until datetime 2010-06-03 10:46:00
        echo %_time
        delay 1
enddo
echo Batchfile done.

Now: 2010-06-03 10:45:50


10:45:50
Batchfile done.
I see the opposite: Using YYYY-MM-DD HH:MM:SS, the appointed time comes and goes, and the loop she just keeps right on a-loopin'.

The compressed format does work as expected.