Batch to output a list of dates from given for /L parameter
<p>Please consider the following codes:</p>

<pre><code>@echo off
setlocal enabledelayedexpansion

FOR /L %%G IN (0,1,19) DO (
set /a "Dday=%_day%+%%G"

if %mth% equ sml (
    if !Dday! gtr 30 (
        set "_day=1"
        set /a "_month+=1"          
    )
    if !_month! gtr 12 (
        set "_month=1"
        set /a "_year+=1"
    )

) else (
    if %mth% equ big (
        if !Dday! gtr 31 (
            set "_day=1"
            set /a "_month+=1"
        ) 
        if !_month! gtr 12 (
            set "_month=1"
            set /a "_year+=1"
        )
    )
)

echo !Dday!/!_month!/!_year!.txt
)
</code></pre>

<p>Consider the following date: 20/04/2016</p>

<p><code>_day = 20</code>; <code>_month = 04</code>; <code>_year = 2016</code>; <code>mth=sml</code>;</p>

<p>and my output is this: </p>

<p><a href="https://i.stack.imgur.com/SiBzX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SiBzX.jpg" alt="enter image description here"></a></p>

<p>It increases the day from 30 instead of changing it to 1. Can I know what have I done wrong? Please advise. Thanks </p>