Do UNTIL DATETIME date time

May 20, 2008
11,391
99
Syracuse, NY, USA
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:\>
 
May 20, 2008
11,391
99
Syracuse, NY, USA
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:\>
 
May 20, 2008
3,515
4
Elkridge, MD, USA
----- 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
 
May 20, 2008
11,391
99
Syracuse, NY, USA
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
 
May 20, 2008
11,391
99
Syracuse, NY, USA
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.
 
May 20, 2008
603
0
Sammamish, WA
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
4,448
88
Albuquerque, NM
prospero.unm.edu
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.
 
Similar threads
Thread starter Title Forum Replies Date
David McClelland Fixed delay until question Support 3
A TCMD10 doesn't save options until restarted Support 10
sully9 How to? Unexpected %DATE% CMD variable format (vs DATE /T format) in CMDebug Support 1
mfarah Fixed The DATE command produces the wrong error message. Support 1
T Date format date different from cmd Support 7
Jesse Heines How to? How to display picture creation date with dir command Support 6
Jesse Heines "Taken" date for JPG and PNG files Support 4
Joe Caverly DATE format 4 Support 7
fpefpe touch - date format Support 2
C 7zip with date range .vs. filelist created with dir and daterange Support 0
C How to? Add date/time to custom tpipe based BTM Support 1
vefatica Download center not up to date Support 4
Joe Caverly How to? Date Range in command line for 7zip /= Support 1
N date and cmd compatibility Support 10
rps Functions @year[date] @isowyear[date] help Support 7
S Closing date for V16 suggestions Support 1
JohnQSmith DATE /T Support 13
A How to? Create a date range based upon creation date Support 2
S How to? Command dialogs vs. size/date/etc. exclusion ranges Support 1
M How to? Effectively "combine" date and time ranges... Support 2
CWBillow Make a folder named Date-Time Support 18
S Date range question Support 4
Roedy date range documentation error Support 2
Jay Sage Inconsistency in Date Formats Between @DATE and @MAKEDATE Support 3
dcantor More date-related help items for V11 Support 0
dcantor Help text for Date Formats Support 0
dcantor Suggestion for @DATE[] input Support 2
dcantor @DATE help example Support 0
CWBillow Date and Time in names Support 11

Similar threads