Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Virtual" means never knowing where your next byte is coming from.


devel / alt.msdos.batch / DOS Batch program countdown days until a given date.

SubjectAuthor
* DOS Batch program countdown days until a given date.Chris Roberts
+- Re: DOS Batch program countdown days until a given date.Kerr-Mudd, John
+* Re: DOS Batch program countdown days until a given date.Kerr-Mudd, John
|`* Re: DOS Batch program countdown days until a given date.Chris Roberts
| +* Re: DOS Batch program countdown days until a given date.Chris Roberts
| |`* Re: DOS Batch program countdown days until a given date.Herbert Kleebauer
| | `* Re: DOS Batch program countdown days until a given date.Chris Roberts
| |  +- Re: DOS Batch program countdown days until a given date.Robert Roland
| |  `* Re: DOS Batch program countdown days until a given date.Herbert Kleebauer
| |   `* Re: DOS Batch program countdown days until a given date.Chris Roberts
| |    `* Re: DOS Batch program countdown days until a given date.Herbert Kleebauer
| |     `- Re: DOS Batch program countdown days until a given date.Chris Roberts
| `- Re: DOS Batch program countdown days until a given date.Kerr-Mudd, John
`* Re: DOS Batch program countdown days until a given date.Herbert Kleebauer
 `* Re: DOS Batch program countdown days until a given date.JJ
  `* Re: DOS Batch program countdown days until a given date.Herbert Kleebauer
   `- Re: DOS Batch program countdown days until a given date.JJ

1
DOS Batch program countdown days until a given date.

<90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=111&group=alt.msdos.batch#111

  copy link   Newsgroups: alt.msdos.batch
X-Received: by 2002:a37:f514:: with SMTP id l20mr20108097qkk.458.1643814123259;
Wed, 02 Feb 2022 07:02:03 -0800 (PST)
X-Received: by 2002:a05:622a:199e:: with SMTP id u30mr17836511qtc.564.1643814122500;
Wed, 02 Feb 2022 07:02:02 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.msdos.batch
Date: Wed, 2 Feb 2022 07:02:02 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=173.79.137.133; posting-account=tSqayAoAAADEbq2bVxu4ODgY7tmW5dUx
NNTP-Posting-Host: 173.79.137.133
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
Subject: DOS Batch program countdown days until a given date.
From: thecjg...@gmail.com (Chris Roberts)
Injection-Date: Wed, 02 Feb 2022 15:02:03 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 15
 by: Chris Roberts - Wed, 2 Feb 2022 15:02 UTC

DOS Batch program to countdown days/year (countdown date)

Hi,
Maybe someone can assist?
I am having trouble figuring out how to do this using a DOS/BATCH program.

For instance.
$ echo %date%%time%
Wed 02/02/2022 9:54:30.16

Would someone here know how I can subtract todays date from 11/8/22 to easily see how many days I still have to go?

Thanks
crzzy1

Re: DOS Batch program countdown days until a given date.

<20220202164835.40d22056747236794361a8bb@127.0.0.1>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=112&group=alt.msdos.batch#112

  copy link   Newsgroups: alt.msdos.batch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: adm...@127.0.0.1 (Kerr-Mudd, John)
Newsgroups: alt.msdos.batch
Subject: Re: DOS Batch program countdown days until a given date.
Date: Wed, 2 Feb 2022 16:48:35 +0000
Organization: Dis
Lines: 23
Message-ID: <20220202164835.40d22056747236794361a8bb@127.0.0.1>
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="141b69e5c683ec8f1dfa21e4495eb844";
logging-data="28347"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18dkANT33rKrWdYK/D5YPXZNbSFzgrHhVc="
Cancel-Lock: sha1:sKl3/dInK6B8IYykGuhuAPgY35w=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
;X-no-Archive: Maybe
GNU: Terry Pratchett
 by: Kerr-Mudd, John - Wed, 2 Feb 2022 16:48 UTC

On Wed, 2 Feb 2022 07:02:02 -0800 (PST)
Chris Roberts <thecjguy1@gmail.com> wrote:

> DOS Batch program to countdown days/year (countdown date)
>
> Hi,
> Maybe someone can assist?
> I am having trouble figuring out how to do this using a DOS/BATCH program.
>
> For instance.
> $ echo %date%%time%
> Wed 02/02/2022 9:54:30.16
>
> Would someone here know how I can subtract todays date from 11/8/22 to easily see how many days I still have to go?
>
> Thanks
> crzzy1
>
>

--
Bah, and indeed Humbug.

Re: DOS Batch program countdown days until a given date.

<20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=113&group=alt.msdos.batch#113

  copy link   Newsgroups: alt.msdos.batch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: adm...@127.0.0.1 (Kerr-Mudd, John)
Newsgroups: alt.msdos.batch
Subject: Re: DOS Batch program countdown days until a given date.
Date: Wed, 2 Feb 2022 16:53:49 +0000
Organization: Dis
Lines: 26
Message-ID: <20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1>
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="141b69e5c683ec8f1dfa21e4495eb844";
logging-data="28347"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX180eMDQ18JOcKg8TkwowftCfhxkXXaEJos="
Cancel-Lock: sha1:HqCBLakMZcUzcFGj2R9+0GSB2FU=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
;X-no-Archive: Maybe
GNU: Terry Pratchett
 by: Kerr-Mudd, John - Wed, 2 Feb 2022 16:53 UTC

On Wed, 2 Feb 2022 07:02:02 -0800 (PST)
Chris Roberts <thecjguy1@gmail.com> wrote:

> DOS Batch program to countdown days/year (countdown date)
>
> Hi,
> Maybe someone can assist?
> I am having trouble figuring out how to do this using a DOS/BATCH program.
>
> For instance.
> $ echo %date%%time%
> Wed 02/02/2022 9:54:30.16
>
> Would someone here know how I can subtract todays date from 11/8/22 to easily see how many days I still have to go?

>
Timo Salmi has probably "curated" an answer;

FWSE phrase "batch date arithmetic"

or are you a troll? 11/8/22 is ambiguous (US v UK date format)
--
Bah, and indeed Humbug.

Re: DOS Batch program countdown days until a given date.

<stedlm$1p1d$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=114&group=alt.msdos.batch#114

  copy link   Newsgroups: alt.msdos.batch
Path: i2pn2.org!i2pn.org!aioe.org!k9ANTw7OG/Gyxov0cRr+eg.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.msdos.batch
Subject: Re: DOS Batch program countdown days until a given date.
Date: Wed, 2 Feb 2022 18:05:59 +0100
Organization: Aioe.org NNTP Server
Message-ID: <stedlm$1p1d$1@gioia.aioe.org>
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="58413"; posting-host="k9ANTw7OG/Gyxov0cRr+eg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Herbert Kleebauer - Wed, 2 Feb 2022 17:05 UTC

On 02.02.2022 16:02, Chris Roberts wrote:
> DOS Batch program to countdown days/year (countdown date)
>
> Hi,
> Maybe someone can assist?
> I am having trouble figuring out how to do this using a DOS/BATCH program.
>
> For instance.
> $ echo %date%%time%
> Wed 02/02/2022 9:54:30.16
>
> Would someone here know how I can subtract todays date from 11/8/22 to easily see how many days I still have to go?

Below are two subroutines which convert a date to the
numbers of days since 1. Jan. 1901 and reverse. Just call
the subroutine :date2day for both dates and calculate
the difference.

@echo off
setlocal disabledelayedexpansion

:: extract the variables %y% %m% %d% from the %date% variable
:: (this depends on the local date format)
:: valid year range: 1901-2099

set /a y=2004
set /a m=3
set /a d=1

call :date2day
set /a w=%w%-1
call :day2date

echo %y% %m% %d%
goto :eof

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: convert the date in %y% %m% %d% to the number of days (%w%) ::
:: since 1901 (day 0 is 1. Jan. 1901) ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:date2day
set /a w=(%y%-1901)*365+(%y%-1901)/4+%d%-1+(!(%y% %% 4))*(!((%m%-3)^&16))
set /a w=(%w%+(%m%-1)*30+2*(!((%m%-7)^&16))-1+((65611044^>^>(2*%m%))^&3))
echo %y% %m% %d% %w%
goto :eof

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: convert the number of days in %w% to the date (%y% %m% %d%) ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:day2date
set /a x=%w%/1461
set /a w=%w%-%x%*1461
set /a z=%w%/365-((%w%/365)^>^>2)
set /a w=%w%-%z%*365
set /a y=1901+%x%*4+%z%
set /a v=%w%-!(%y% %% 4)
set /a m=!!(%w%/31)+!!(%v%/59)+!!(%v%/90)+!!(%v%/120)+!!(%v%/151)+!!(%v%/181)
set /a m=%m%+!!(%v%/212)+!!(%v%/243)+!!(%v%/273)+!!(%v%/304)+!!(%v%/334)+1
set /a d=%w%+1-(!(%y% %% 4))*(!((%m%-3)^&16))
set /a d=%d%-((%m%-1)*30+2*(!((%m%-7)^&16))-1+((65611044^>^>(2*%m%))^&3))
goto :eof

Re: DOS Batch program countdown days until a given date.

<b4946f60-c5ad-460d-a67d-98a0ccd0705an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=115&group=alt.msdos.batch#115

  copy link   Newsgroups: alt.msdos.batch
X-Received: by 2002:a05:6214:29ec:: with SMTP id jv12mr27570280qvb.87.1643829204518;
Wed, 02 Feb 2022 11:13:24 -0800 (PST)
X-Received: by 2002:a05:6214:19ce:: with SMTP id j14mr28048653qvc.106.1643829204208;
Wed, 02 Feb 2022 11:13:24 -0800 (PST)
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.msdos.batch
Date: Wed, 2 Feb 2022 11:13:23 -0800 (PST)
In-Reply-To: <20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1>
Injection-Info: google-groups.googlegroups.com; posting-host=4.79.195.162; posting-account=tSqayAoAAADEbq2bVxu4ODgY7tmW5dUx
NNTP-Posting-Host: 4.79.195.162
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com> <20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b4946f60-c5ad-460d-a67d-98a0ccd0705an@googlegroups.com>
Subject: Re: DOS Batch program countdown days until a given date.
From: thecjg...@gmail.com (Chris Roberts)
Injection-Date: Wed, 02 Feb 2022 19:13:24 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 28
 by: Chris Roberts - Wed, 2 Feb 2022 19:13 UTC

On Wednesday, February 2, 2022 at 11:53:51 AM UTC-5, Kerr-Mudd, John wrote:
> On Wed, 2 Feb 2022 07:02:02 -0800 (PST)
> Chris Roberts <thec...@gmail.com> wrote:
> > DOS Batch program to countdown days/year (countdown date)
> >
> > Hi,
> > Maybe someone can assist?
> > I am having trouble figuring out how to do this using a DOS/BATCH program.
> >
> > For instance.
> > $ echo %date%%time%
> > Wed 02/02/2022 9:54:30.16
> >
> > Would someone here know how I can subtract todays date from 11/8/22 to easily see how many days I still have to go?
>
>
> >
> Timo Salmi has probably "curated" an answer;
>
> FWSE phrase "batch date arithmetic"
>
>
>
> or are you a troll? 11/8/22 is ambiguous (US v UK date format)
> --
> Bah, and indeed Humbug.

Nope, Not a troll. I used the world renown election day 11/8/22 just for my example.
UK has the date format all backwards and Who's Timo Salmi? Who "Curates" answers anyway? :-)

Re: DOS Batch program countdown days until a given date.

<2f2220d9-704e-42a3-81ae-26399605e556n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=116&group=alt.msdos.batch#116

  copy link   Newsgroups: alt.msdos.batch
X-Received: by 2002:a05:6214:e6f:: with SMTP id jz15mr27915716qvb.22.1643829540180;
Wed, 02 Feb 2022 11:19:00 -0800 (PST)
X-Received: by 2002:ac8:570a:: with SMTP id 10mr23517452qtw.313.1643829539963;
Wed, 02 Feb 2022 11:18:59 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!2.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.msdos.batch
Date: Wed, 2 Feb 2022 11:18:59 -0800 (PST)
In-Reply-To: <b4946f60-c5ad-460d-a67d-98a0ccd0705an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=4.79.195.162; posting-account=tSqayAoAAADEbq2bVxu4ODgY7tmW5dUx
NNTP-Posting-Host: 4.79.195.162
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
<20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1> <b4946f60-c5ad-460d-a67d-98a0ccd0705an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2f2220d9-704e-42a3-81ae-26399605e556n@googlegroups.com>
Subject: Re: DOS Batch program countdown days until a given date.
From: thecjg...@gmail.com (Chris Roberts)
Injection-Date: Wed, 02 Feb 2022 19:19:00 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 36
 by: Chris Roberts - Wed, 2 Feb 2022 19:18 UTC

On Wednesday, February 2, 2022 at 2:13:25 PM UTC-5, Chris Roberts wrote:
> On Wednesday, February 2, 2022 at 11:53:51 AM UTC-5, Kerr-Mudd, John wrote:
> > On Wed, 2 Feb 2022 07:02:02 -0800 (PST)
> > Chris Roberts <thec...@gmail.com> wrote:
> > > DOS Batch program to countdown days/year (countdown date)
> > >
> > > Hi,
> > > Maybe someone can assist?
> > > I am having trouble figuring out how to do this using a DOS/BATCH program.
> > >
> > > For instance.
> > > $ echo %date%%time%
> > > Wed 02/02/2022 9:54:30.16
> > >
> > > Would someone here know how I can subtract todays date from 11/8/22 to easily see how many days I still have to go?
> >
> >
> > >
> > Timo Salmi has probably "curated" an answer;
> >
> > FWSE phrase "batch date arithmetic"
> >
> >
> >
> > or are you a troll? 11/8/22 is ambiguous (US v UK date format)
> > --
> > Bah, and indeed Humbug.
> Nope, Not a troll. I used the world renown election day 11/8/22 just for my example.
> UK has the date format all backwards and Who's Timo Salmi? Who "Curates" answers anyway? :-)

That's a cool script, I may use it.
But it says it "extract from the %date% variable" and then does NOT use %date% at all and instead statically defines the date.
I don't totally get :day2date It seems like a lot of variables for this simple task.

Thanks,
crzzy1

Re: DOS Batch program countdown days until a given date.

<stersu$rmd$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=117&group=alt.msdos.batch#117

  copy link   Newsgroups: alt.msdos.batch
Path: i2pn2.org!i2pn.org!aioe.org!k9ANTw7OG/Gyxov0cRr+eg.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.msdos.batch
Subject: Re: DOS Batch program countdown days until a given date.
Date: Wed, 2 Feb 2022 22:08:47 +0100
Organization: Aioe.org NNTP Server
Message-ID: <stersu$rmd$1@gioia.aioe.org>
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
<20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1>
<b4946f60-c5ad-460d-a67d-98a0ccd0705an@googlegroups.com>
<2f2220d9-704e-42a3-81ae-26399605e556n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="28365"; posting-host="k9ANTw7OG/Gyxov0cRr+eg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Herbert Kleebauer - Wed, 2 Feb 2022 21:08 UTC

On 02.02.2022 20:18, Chris Roberts wrote:

> That's a cool script, I may use it.
> But it says it "extract from the %date% variable" and then does NOT use %date% at all and instead statically defines the date.

It says, you should extract the variables %y% %m% %d%
from the %date% variable. Because the code depends on
the local date format, it is not done in my example
but instead some fixed values are used to show the
usage of the two subroutines.

> I don't totally get :day2date It seems like a lot of variables for this simple task.

If it is a simple task, then do it yourself and
show us your code. Maybe there really is a much
simpler solution (I wanted a version without "IF"
and "GOTO").

Re: DOS Batch program countdown days until a given date.

<20220202221314.03268903954b3d728c76d78a@127.0.0.1>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=118&group=alt.msdos.batch#118

  copy link   Newsgroups: alt.msdos.batch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: adm...@127.0.0.1 (Kerr-Mudd, John)
Newsgroups: alt.msdos.batch
Subject: Re: DOS Batch program countdown days until a given date.
Date: Wed, 2 Feb 2022 22:13:14 +0000
Organization: Dis
Lines: 41
Message-ID: <20220202221314.03268903954b3d728c76d78a@127.0.0.1>
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
<20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1>
<b4946f60-c5ad-460d-a67d-98a0ccd0705an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="141b69e5c683ec8f1dfa21e4495eb844";
logging-data="24893"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/K/LZqMAgNggJniTqq0drTImU/p7sheYs="
Cancel-Lock: sha1:KNoG6jPreU89LYNI3TN3bz4wpAI=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
;X-no-Archive: Maybe
GNU: Terry Pratchett
 by: Kerr-Mudd, John - Wed, 2 Feb 2022 22:13 UTC

On Wed, 2 Feb 2022 11:13:23 -0800 (PST)
Chris Roberts <thecjguy1@gmail.com> wrote:

> On Wednesday, February 2, 2022 at 11:53:51 AM UTC-5, Kerr-Mudd, John wrote:
> > On Wed, 2 Feb 2022 07:02:02 -0800 (PST)
> > Chris Roberts <thec...@gmail.com> wrote:
> > > DOS Batch program to countdown days/year (countdown date)
> > >
> > > Hi,
> > > Maybe someone can assist?
> > > I am having trouble figuring out how to do this using a DOS/BATCH program.
> > >
> > > For instance.
> > > $ echo %date%%time%
> > > Wed 02/02/2022 9:54:30.16
> > >
> > > Would someone here know how I can subtract todays date from 11/8/22 to easily see how many days I still have to go?
> >
> >
> > >
> > Timo Salmi has probably "curated" an answer;
> >
> > FWSE phrase "batch date arithmetic"
> >
> >
> >
> > or are you a troll? 11/8/22 is ambiguous (US v UK date format)
> > --
> > Bah, and indeed Humbug.
>
> Nope, Not a troll. I used the world renown election day 11/8/22 just for my example.
> UK has the date format all backwards and Who's Timo Salmi? Who "Curates" answers anyway? :-)

This fellow:

http://www.elisanet.fi/tsalmi/info/tscmd001.html

He copied stuff from amb onto his web pages which he then claimed his copyright to. To be fair he did write a lot of the stuff himself as well.

--
Bah, and indeed Humbug.

Re: DOS Batch program countdown days until a given date.

<1cunoj6v0youq.z5eke3nqrg65$.dlg@40tude.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=119&group=alt.msdos.batch#119

  copy link   Newsgroups: alt.msdos.batch
Path: i2pn2.org!i2pn.org!aioe.org!pE04nM/4DvlO2w4E2SlC2g.user.46.165.242.91.POSTED!not-for-mail
From: jj4pub...@gmail.com (JJ)
Newsgroups: alt.msdos.batch
Subject: Re: DOS Batch program countdown days until a given date.
Date: Thu, 3 Feb 2022 16:05:49 +0700
Organization: Aioe.org NNTP Server
Message-ID: <1cunoj6v0youq.z5eke3nqrg65$.dlg@40tude.net>
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com> <stedlm$1p1d$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="23443"; posting-host="pE04nM/4DvlO2w4E2SlC2g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: 40tude_Dialog/2.0.15.84
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
X-Notice: Filtered by postfilter v. 0.9.2
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
 by: JJ - Thu, 3 Feb 2022 09:05 UTC

On Wed, 2 Feb 2022 18:05:59 +0100, Herbert Kleebauer wrote:
> On 02.02.2022 16:02, Chris Roberts wrote:
>> DOS Batch program to countdown days/year (countdown date)
>>
>> Hi,
>> Maybe someone can assist?
>> I am having trouble figuring out how to do this using a DOS/BATCH program.
>>
>> For instance.
>> $ echo %date%%time%
>> Wed 02/02/2022 9:54:30.16
>>
>> Would someone here know how I can subtract todays date from 11/8/22 to easily see how many days I still have to go?
>
> Below are two subroutines which convert a date to the
> numbers of days since 1. Jan. 1901 and reverse. Just call
> the subroutine :date2day for both dates and calculate
> the difference.
>
> @echo off
> setlocal disabledelayedexpansion
>
>:: extract the variables %y% %m% %d% from the %date% variable
>:: (this depends on the local date format)
[snip]

And to detect the current date format, it can be done like below (warning:
long text).

@echo off
setlocal enabledelayedexpansion

for /f "delims=" %%A in ('2^>nul wmic /namespace:\\root\default class stdregprov call getstringvalue hdefkey^="&h80000001" ssubkeyname^="control panel\international" svaluename^=sshortdate ^| find "sValue"') do (
for /f "tokens=3 delims=; " %%B in ("%%A") do set f=%%B
) set f=%f:~1,-1%
echo date format = %f%

rem i=index (-1=none), l=length
set yi=-1
set yl=0
set mi=-1
set ml=0
set di=-1
set dl=0
for /l %%A in (0,1,9) do (
if "!f:~%%A,1!" == "y" (
if !yi! lss 0 set yi=%%A
set/a yl+=1
) else if "!f:~%%A,1!" == "M" (
if !mi! lss 0 set mi=%%A
set/a ml+=1
) else if "!f:~%%A,1!" == "d" (
if !di! lss 0 set di=%%A
set/a dl+=1
)
) echo year: index=%yi%, length=%yl%
echo month: index=%mi%, length=%ml%
echo date: index=%di%, length=%dl%

Re: DOS Batch program countdown days until a given date.

<stgb4l$18qj$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=120&group=alt.msdos.batch#120

  copy link   Newsgroups: alt.msdos.batch
Path: i2pn2.org!i2pn.org!aioe.org!UdxPb43NEhP+XxgaQbn7FA.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.msdos.batch
Subject: Re: DOS Batch program countdown days until a given date.
Date: Thu, 3 Feb 2022 11:35:02 +0100
Organization: Aioe.org NNTP Server
Message-ID: <stgb4l$18qj$1@gioia.aioe.org>
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
<stedlm$1p1d$1@gioia.aioe.org> <1cunoj6v0youq.z5eke3nqrg65$.dlg@40tude.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="41811"; posting-host="UdxPb43NEhP+XxgaQbn7FA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Herbert Kleebauer - Thu, 3 Feb 2022 10:35 UTC

On 03.02.2022 10:05, JJ wrote:

>>:: extract the variables %y% %m% %d% from the %date% variable
>>:: (this depends on the local date format)
> [snip]
>
> And to detect the current date format, it can be done like below (warning:
> long text).

> for /f "delims=" %%A in ('2^>nul wmic

If you use wmic anyhow, you can also use it to directly
get the date:

@echo off
for /f "tokens=*" %%i in ('wmic os get LocalDateTime /value^|find "l"') do set %%i
echo year=%localdatetime:~0,4%
echo month=%localdatetime:~4,2%
echo day=%localdatetime:~6,2%

Re: DOS Batch program countdown days until a given date.

<1ohgij3xcqxbp.1sdcbdfidxc8i.dlg@40tude.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=121&group=alt.msdos.batch#121

  copy link   Newsgroups: alt.msdos.batch
Path: i2pn2.org!i2pn.org!aioe.org!pE04nM/4DvlO2w4E2SlC2g.user.46.165.242.91.POSTED!not-for-mail
From: jj4pub...@gmail.com (JJ)
Newsgroups: alt.msdos.batch
Subject: Re: DOS Batch program countdown days until a given date.
Date: Fri, 4 Feb 2022 16:45:30 +0700
Organization: Aioe.org NNTP Server
Message-ID: <1ohgij3xcqxbp.1sdcbdfidxc8i.dlg@40tude.net>
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com> <stedlm$1p1d$1@gioia.aioe.org> <1cunoj6v0youq.z5eke3nqrg65$.dlg@40tude.net> <stgb4l$18qj$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="39919"; posting-host="pE04nM/4DvlO2w4E2SlC2g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: 40tude_Dialog/2.0.15.84
X-Notice: Filtered by postfilter v. 0.9.2
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
 by: JJ - Fri, 4 Feb 2022 09:45 UTC

On Thu, 3 Feb 2022 11:35:02 +0100, Herbert Kleebauer wrote:
> On 03.02.2022 10:05, JJ wrote:
>
>>>:: extract the variables %y% %m% %d% from the %date% variable
>>>:: (this depends on the local date format)
>> [snip]
>>
>> And to detect the current date format, it can be done like below (warning:
>> long text).
>
>> for /f "delims=" %%A in ('2^>nul wmic
>
> If you use wmic anyhow, you can also use it to directly
> get the date:
>
> @echo off
> for /f "tokens=*" %%i in ('wmic os get LocalDateTime /value^|find "l"') do set %%i
> echo year=%localdatetime:~0,4%
> echo month=%localdatetime:~4,2%
> echo day=%localdatetime:~6,2%

Good thinking.

Re: DOS Batch program countdown days until a given date.

<23d9c7f8-7b8d-4e48-93e4-86d9efe47485n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=122&group=alt.msdos.batch#122

  copy link   Newsgroups: alt.msdos.batch
X-Received: by 2002:a05:620a:3709:: with SMTP id de9mr694712qkb.746.1644012661310;
Fri, 04 Feb 2022 14:11:01 -0800 (PST)
X-Received: by 2002:ac8:ccd:: with SMTP id o13mr856239qti.402.1644012661073;
Fri, 04 Feb 2022 14:11:01 -0800 (PST)
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.msdos.batch
Date: Fri, 4 Feb 2022 14:11:00 -0800 (PST)
In-Reply-To: <stersu$rmd$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=4.79.195.162; posting-account=tSqayAoAAADEbq2bVxu4ODgY7tmW5dUx
NNTP-Posting-Host: 4.79.195.162
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
<20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1> <b4946f60-c5ad-460d-a67d-98a0ccd0705an@googlegroups.com>
<2f2220d9-704e-42a3-81ae-26399605e556n@googlegroups.com> <stersu$rmd$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <23d9c7f8-7b8d-4e48-93e4-86d9efe47485n@googlegroups.com>
Subject: Re: DOS Batch program countdown days until a given date.
From: thecjg...@gmail.com (Chris Roberts)
Injection-Date: Fri, 04 Feb 2022 22:11:01 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 74
 by: Chris Roberts - Fri, 4 Feb 2022 22:11 UTC

On Wednesday, February 2, 2022 at 4:08:53 PM UTC-5, Herbert Kleebauer wrote:
> On 02.02.2022 20:18, Chris Roberts wrote:
>
> > That's a cool script, I may use it.
> > But it says it "extract from the %date% variable" and then does NOT use %date% at all and instead statically defines the date.
> It says, you should extract the variables %y% %m% %d%
> from the %date% variable. Because the code depends on
> the local date format, it is not done in my example
> but instead some fixed values are used to show the
> usage of the two subroutines.
> > I don't totally get :day2date It seems like a lot of variables for this simple task.
> If it is a simple task, then do it yourself and
> show us your code. Maybe there really is a much
> simpler solution (I wanted a version without "IF"
> and "GOTO").

JJ, thanks for your input.

Herbert Kleebauer,
You are correct. "then do it yourself and show us your code"
I really didn't know how to get the output of "date"
and then... do math with it. (I am way behind you guys on this DOS stuff).
I have worked more with at bash and python, but now at a windows centric job so trying to learn to do it all again with DOS.. :-(

Here is what I have so far:
not worried about formatting.
and
No, It's not correct. There is NOT 30 days/month and NOT 365 days/year.
The examples you guys have provided in this thread has really helped me.
feel free to pick and refine any or all of it.

####
@ECHO off
setlocal EnableDelayedExpansion
set dd=%date:~10,4%-%date:~7,2%-%date:~4,2%
:: separate the present year into fields
for /f "tokens=1,2* delims=- " %%A in ('ECHO %dd%') do (
Set PresY=%%A
Set PresD=%%B
Set PresM=%%C
) :: separate the ret year into fields
set ret=2029-06-8
for /f "tokens=1,2* delims=- " %%G in ('ECHO %ret%') do (
Set RetY=%%G
Set RetD=%%H
Set RetM=%%I
) set /a diff_y=%RetY%-%PresY%
set /a diff_m=%RetM%-%PresM%
set /a diff_d=%RetD%-%PresD%
echo Present date is: %dd%
echo Retirement date is: %ret%
echo time to wait is:
ECHO Years %diff_y%
ECHO Months %diff_m%
ECHO Days %diff_d%
::calculat days until retirement.
set /a Days=%diff_y%*365+%diff_m%*30+%diff_d%
echo Days until retirement is %Days%

###(OUTPUT)###
$ retire
Present date is: 2022-04-02
Retirement date is: 2029-06-8
time to wait is:
Years 7
Months 6
Days 2
Days until retirement is 2737
###

Re: DOS Batch program countdown days until a given date.

<m37tvgdmjbuaqfjdrrutnvrar9qi1bgjgf@4ax.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=123&group=alt.msdos.batch#123

  copy link   Newsgroups: alt.msdos.batch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: fak...@ddress.no (Robert Roland)
Newsgroups: alt.msdos.batch
Subject: Re: DOS Batch program countdown days until a given date.
Date: Sat, 05 Feb 2022 17:13:23 +0100
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <m37tvgdmjbuaqfjdrrutnvrar9qi1bgjgf@4ax.com>
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com> <20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1> <b4946f60-c5ad-460d-a67d-98a0ccd0705an@googlegroups.com> <2f2220d9-704e-42a3-81ae-26399605e556n@googlegroups.com> <stersu$rmd$1@gioia.aioe.org> <23d9c7f8-7b8d-4e48-93e4-86d9efe47485n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="3672769852d48055ba51c970b3120d80";
logging-data="30758"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gunhstQ7zNHR+MFezW3Ri"
Cancel-Lock: sha1:GpN7b+nuj2uWb6UAgO/b9yn5YVU=
X-Newsreader: Forte Agent 4.2/32.1117
 by: Robert Roland - Sat, 5 Feb 2022 16:13 UTC

On Fri, 4 Feb 2022 14:11:00 -0800 (PST), Chris Roberts
<thecjguy1@gmail.com> wrote:

>windows centric job so trying to learn

There is a large difference between MS-DOS and Windows' Command
Prompt. The batch language in Windows is quite a bit more powerful.
Additionally, you can take advantage of built-in features like
VBScript and PowerShell.

For simple things, batch is still quite handy, but for anything
non-trivial (like date arithmetic), there are better options.

Date arithmetic is super simple in PowerShell. And if you need to, you
can also wrap PowerShell scripts in a batch script.

In PowerShell, your problem could be solved like this:

((Get-Date -Day 8 -Month 11 -Year 2022) - (Get-Date)).Days

If you want to wrap it in a batch script, do this (single line):

powershell -command "((Get-Date -Day 8 -Month 11 -Year 2022) -
(Get-Date)).Days"

Note that this formula will give you the time from now until the same
time of day on that other date. If you want to calculate the time
until the clock strikes midnight on that day, you will need to also
specify hours, minutes and seconds.
--
RoRo

Re: DOS Batch program countdown days until a given date.

<stmbrs$p8v$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=124&group=alt.msdos.batch#124

  copy link   Newsgroups: alt.msdos.batch
Path: i2pn2.org!i2pn.org!aioe.org!nhng2xk5AK8hxUehJ/cd2w.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.msdos.batch
Subject: Re: DOS Batch program countdown days until a given date.
Date: Sat, 5 Feb 2022 18:24:12 +0100
Organization: Aioe.org NNTP Server
Message-ID: <stmbrs$p8v$1@gioia.aioe.org>
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
<20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1>
<b4946f60-c5ad-460d-a67d-98a0ccd0705an@googlegroups.com>
<2f2220d9-704e-42a3-81ae-26399605e556n@googlegroups.com>
<stersu$rmd$1@gioia.aioe.org>
<23d9c7f8-7b8d-4e48-93e4-86d9efe47485n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="25887"; posting-host="nhng2xk5AK8hxUehJ/cd2w.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Herbert Kleebauer - Sat, 5 Feb 2022 17:24 UTC

On 04.02.2022 23:11, Chris Roberts wrote:

> I have worked more with at bash and python, but now at a windows centric job so trying to learn to do it all again with DOS.. :-(

Why not activate the "Windows Subsystem for Linux" and use bash?

https://docs.microsoft.com/en-us/windows/wsl/

> set ret=2029-06-8
> for /f "tokens=1,2* delims=- " %%G in ('ECHO %ret%') do (
> Set RetY=%%G
> Set RetD=%%H
> Set RetM=%%I
> )
> set /a diff_y=%RetY%-%PresY%
> set /a diff_m=%RetM%-%PresM%
> set /a diff_d=%RetD%-%PresD%
> echo Present date is: %dd%

Just a note: numbers staring with "0" are octal numbers.
So if RetD is "08", it can't be used in a "set /a" command
because 08 isn't a legal octal number.

Re: DOS Batch program countdown days until a given date.

<123ee883-c11e-42c8-bfb8-ff529eeb11bbn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=129&group=alt.msdos.batch#129

  copy link   Newsgroups: alt.msdos.batch
X-Received: by 2002:a37:a855:: with SMTP id r82mr6400606qke.645.1644244268487;
Mon, 07 Feb 2022 06:31:08 -0800 (PST)
X-Received: by 2002:a05:6214:234c:: with SMTP id hu12mr10484832qvb.100.1644244268243;
Mon, 07 Feb 2022 06:31:08 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.msdos.batch
Date: Mon, 7 Feb 2022 06:31:08 -0800 (PST)
In-Reply-To: <stmbrs$p8v$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=4.79.195.162; posting-account=tSqayAoAAADEbq2bVxu4ODgY7tmW5dUx
NNTP-Posting-Host: 4.79.195.162
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
<20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1> <b4946f60-c5ad-460d-a67d-98a0ccd0705an@googlegroups.com>
<2f2220d9-704e-42a3-81ae-26399605e556n@googlegroups.com> <stersu$rmd$1@gioia.aioe.org>
<23d9c7f8-7b8d-4e48-93e4-86d9efe47485n@googlegroups.com> <stmbrs$p8v$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <123ee883-c11e-42c8-bfb8-ff529eeb11bbn@googlegroups.com>
Subject: Re: DOS Batch program countdown days until a given date.
From: thecjg...@gmail.com (Chris Roberts)
Injection-Date: Mon, 07 Feb 2022 14:31:08 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 74
 by: Chris Roberts - Mon, 7 Feb 2022 14:31 UTC

On Saturday, February 5, 2022 at 12:24:16 PM UTC-5, Herbert Kleebauer wrote:
> On 04.02.2022 23:11, Chris Roberts wrote:
>
> > I have worked more with at bash and python, but now at a windows centric job so trying to learn to do it all again with DOS.. :-(
> Why not activate the "Windows Subsystem for Linux" and use bash?
>
> https://docs.microsoft.com/en-us/windows/wsl/
> > set ret=2029-06-8
> > for /f "tokens=1,2* delims=- " %%G in ('ECHO %ret%') do (
> > Set RetY=%%G
> > Set RetD=%%H
> > Set RetM=%%I
> > )
> > set /a diff_y=%RetY%-%PresY%
> > set /a diff_m=%RetM%-%PresM%
> > set /a diff_d=%RetD%-%PresD%
> > echo Present date is: %dd%
> Just a note: numbers staring with "0" are octal numbers.
> So if RetD is "08", it can't be used in a "set /a" command
> because 08 isn't a legal octal number.

Thank you Herbert,
I see what you mean on the "numbers staring with "0" are octal" (That is why it wouldn't work with "08" in retirement date. See, I am learned something already... Thanks. )
Lets just hope we don't have any months beyond August. :-)
I have usually have both (via ConEmu) DOS and a "Ubuntu bash prompt" up on my PC.
I just want to know more about DOS batch.
Also, I like that I can easily open apps from DOS. (ie: DOS's "start EditPadLite8.exe %1" just works better than my ubuntu's alias bb='notepad++.exe' as the later won't just accept any path)
So if I wanted to fit retirement.bat or some other garbage into another batch program that also opened my schedule in an excel spreadsheet I could.
I cleaned it up a bit: (Below)

@ECHO off
:: setlocal EnableDelayedExpansion ::Doesn't seem to make any difference, why do people use this anyway?
:: Need to add logic to permit to or ommit leading 0's from the date. due to Octal
set retirement_date=6-8-2027
::set dd=%date:~10,4%-%date:~7,2%-%date:~4,2%
set dd=%date:~4,2%-%date:~7,2%-%date:~10,4%
:: separate the present year into fields
for /f "tokens=1,2* delims=- " %%A in ('ECHO %dd%') do (
Set PresM=%%A
Set PresD=%%B
Set PresY=%%C
) :: separate the retirement_date.
for /f "tokens=1,2* delims=- " %%G in ('ECHO %retirement_date%') do (
Set RetM=%%G
Set RetD=%%H
Set RetY=%%I
) set /a diff_y=%RetY%-%PresY%
set /a diff_m=%RetM%-%PresM%
set /a diff_d=%RetD%-%PresD%
::ECHO retirment month %RetM%
::ECHO Pres month %PresM%
::ECHO retirment DAY %RetD%
::ECHO Pres DAY %PresD%
::ECHO %RetD%
ECHO Present date is: %dd%
ECHO Retirement date is: %retirement_date%
ECHO:
ECHO %diff_y% Years
ECHO %diff_m% Months
ECHO %diff_d% Days
::calculate days until your retirement.
set /a Days=%diff_y%*365+%diff_m%*30+%diff_d%
ECHO TIME TO WAIT until retirement is %Days% Days.
###OUTPUT###
$ retire
Present date is: 02-07-2022
Retirement date is: 6-8-2027

5 Years
4 Months
1 Days
TIME TO WAIT until retirement is 1946 Days.
###

Re: DOS Batch program countdown days until a given date.

<strhcj$17s$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=130&group=alt.msdos.batch#130

  copy link   Newsgroups: alt.msdos.batch
Path: i2pn2.org!i2pn.org!aioe.org!F81j+sdd0rKYM5DwW6j7BQ.user.46.165.242.91.POSTED!not-for-mail
From: kle...@unibwm.de (Herbert Kleebauer)
Newsgroups: alt.msdos.batch
Subject: Re: DOS Batch program countdown days until a given date.
Date: Mon, 7 Feb 2022 17:29:06 +0100
Organization: Aioe.org NNTP Server
Message-ID: <strhcj$17s$1@gioia.aioe.org>
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
<20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1>
<b4946f60-c5ad-460d-a67d-98a0ccd0705an@googlegroups.com>
<2f2220d9-704e-42a3-81ae-26399605e556n@googlegroups.com>
<stersu$rmd$1@gioia.aioe.org>
<23d9c7f8-7b8d-4e48-93e4-86d9efe47485n@googlegroups.com>
<stmbrs$p8v$1@gioia.aioe.org>
<123ee883-c11e-42c8-bfb8-ff529eeb11bbn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="1276"; posting-host="F81j+sdd0rKYM5DwW6j7BQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Herbert Kleebauer - Mon, 7 Feb 2022 16:29 UTC

On 07.02.2022 15:31, Chris Roberts wrote:

> I see what you mean on the "numbers staring with "0" are octal" (That is why it wouldn't work with "08" in retirement date. See, I am learned something already... Thanks. )

set n=09
set /a m=1%n%-100
echo %n% - %m%

> set /a diff_y=%RetY%-%PresY%
> set /a diff_m=%RetM%-%PresM%

And if %PresM% is greater than %RetM%?

Re: DOS Batch program countdown days until a given date.

<b23a3445-bd4d-470a-a639-1b904abad5dan@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=157&group=alt.msdos.batch#157

  copy link   Newsgroups: alt.msdos.batch
X-Received: by 2002:a7b:cb44:0:b0:37c:4e2d:3bb2 with SMTP id v4-20020a7bcb44000000b0037c4e2d3bb2mr11833300wmj.96.1645213054995;
Fri, 18 Feb 2022 11:37:34 -0800 (PST)
X-Received: by 2002:ac8:7f96:0:b0:2d7:7836:6d0f with SMTP id
z22-20020ac87f96000000b002d778366d0fmr8124127qtj.676.1645213054393; Fri, 18
Feb 2022 11:37:34 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: alt.msdos.batch
Date: Fri, 18 Feb 2022 11:37:34 -0800 (PST)
In-Reply-To: <strhcj$17s$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=4.79.195.162; posting-account=tSqayAoAAADEbq2bVxu4ODgY7tmW5dUx
NNTP-Posting-Host: 4.79.195.162
References: <90c8faaf-eb9b-43f7-a355-bed3b76f43cbn@googlegroups.com>
<20220202165349.f7b3e53ed8b50ad80936501b@127.0.0.1> <b4946f60-c5ad-460d-a67d-98a0ccd0705an@googlegroups.com>
<2f2220d9-704e-42a3-81ae-26399605e556n@googlegroups.com> <stersu$rmd$1@gioia.aioe.org>
<23d9c7f8-7b8d-4e48-93e4-86d9efe47485n@googlegroups.com> <stmbrs$p8v$1@gioia.aioe.org>
<123ee883-c11e-42c8-bfb8-ff529eeb11bbn@googlegroups.com> <strhcj$17s$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b23a3445-bd4d-470a-a639-1b904abad5dan@googlegroups.com>
Subject: Re: DOS Batch program countdown days until a given date.
From: thecjg...@gmail.com (Chris Roberts)
Injection-Date: Fri, 18 Feb 2022 19:37:34 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 60
 by: Chris Roberts - Fri, 18 Feb 2022 19:37 UTC

#######
Keywords: DOS batch Code to Count Days until retirement or some future date.

Thank you to everyone who replied.
(Except J. Mudd, I never understood a single word he said in this thread).
I found that "Total_Days=%diff_y%*365+%diff_m%*30+%diff_d% "
Works even if the days/months become negative. Then, I can just use the count of days to calculate months/years.

My completed code below:
@ECHO off
:: setlocal EnableDelayedExpansion ::Doesn't make a difference, why do people use this anyway?
::NOTE: remove the leading zero with this little trick: "set /a dd1=(1%dd: =0%-100)-1"
::::::::::::::::
set retirement_date=06-08-2025
::::::::::::::::
set dd=%date:~4,2%-%date:~7,2%-%date:~10,4%
:: separate the present year into fields
for /f "tokens=1,2* delims=- " %%A in ('ECHO %dd%') do (
:: correct way 1%%A-100, because all 0x numbers are octal, so you have to remove the leading "0"
Set /a PresM=1%%A-100
:: echo %PresM%
Set /a PresD=1%%B-100
Set /a PresY=1%%C-100
) :: separate the retirement_date.
for /f "tokens=1,2* delims=- " %%G in ('ECHO %retirement_date%') do (
::Set RetM=%%G
Set /a RetM=1%%G-100
:: echo %RetM%
Set /a RetD=1%%H-100
Set /a RetY=1%%I-100
) set /a diff_y=%RetY%-%PresY%
set /a diff_m=%RetM%-%PresM%
set /a diff_d=%RetD%-%PresD%
set /a Total_Days=%diff_y%*365+%diff_m%*30+%diff_d%
set /a Total_Years=(Total_Days/365)
set /a Remainder_Days=(Total_Days%%365)
set /a Remainder_Months=(Remainder_Days/30)
set /a Remainder_Days2=Remainder_Days%%30

echo ----
ECHO TODAY's Date: %dd%
ECHO RETIREMENT Date: %retirement_date%
ECHO Retirement is just %Total_Days% days away!
echo That is: %Total_Years% Year(s), %Remainder_Months% Months and %Remainder_Days2% Days
echo ----
:::::::
::OUTPUT::
::$ retire
::----
::TODAY's Date: 02-18-2022
::RETIREMENT Date: 06-08-2025
::Retirement is just 1205 days away!
::That is: 3 Year(s), 3 Months and 20 Days
----
:::::::::::::
#######

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor