Build date with Classic ASP

0

People,

I need to return a table of data, depending on the date that the user chooses. But I need to separate the reference month and the day.

I put it to print a paragraph to test if the date function is working, but there is something wrong.

Thecodelookslikethis:

<divclass="container">
            <br><br>
            <h1>Variação Percentual </h1>
            <br>

            <form name = "datas">

                <% dt = day(date)

                    mes = month (date) 
                    ano = year (date)
                    anomes = mes&"/"&ano 
                 %>

                <div class = "row">
                    <div class = "col"><p>Mês de Referência:</p></div>
                    <div class = "col"><input class="form-control-sm center-2" name="mesref" value="<%=anomes%>"></input></div>
                    <div class = "col"><p>Dia Inicial:</p></div>
                    <div class = "col"><input class="form-control-sm center-1" name="dia1" value="<%=dt%>"></input></div>
                    <div class = "col"><p>Dia Final:</p></div>
                    <div class = "col"><input class="form-control-sm center-1" name="dia2" value="<%=dt%>"></input></div>
                </div>

                <%
                    dia1 = Request.Form("dia1")
                    dia2 = Request.Form("dia2")
                    mesref = Request.Form("mesref")
                    amref = right(request.form("mesref"),4)&left(request.form("mesref"),2)

                    data1 =  dia1&"/"&mesref
                    data2 = dia2&"/"&mesref

                    set ValorInicial = conexao.execute("select unidade, am_ref, data_proc FROM tabela where am_ref = '"&amref&"' and data_proc = '"&data1&"'")

                %>

                <p><%= ValorInicial("data_proc") %></p>

Any idea what I'm doing wrong? I've also tried this:

                <%
                    dia1 = Request.Form("dia1")
                    dia2 = Request.Form("dia2")
                    mesref = Request.Form("mesref")
                    amref = right(request.form("mesref"),4)&left(request.form("mesref"),2)

                    data1 =  formatdatetime(dia1&"/"&mesref, 0)
                    data2 = formatdatetime(dia2&"/"&mesref, 0)

                    set ValorInicial = conexao.execute("select unidade, am_ref, data_proc FROM tabela where am_ref = '"&amref&"' and data_proc = '"&data1&"'")

                %>

But then there was this error:

    
asked by anonymous 13.12.2018 / 16:39

0 answers