How to generate dates with json?

0

Good morning, working with this calendar there is a part where you color a few days , then change the code in the dataSource:

dataSource: 
                [
                    {
                    url : 'calendario/dataSource.jsp',
                    }
                ]

In the JSP I get the following: {"endDate":"new Date(2010, 07, 20)","startDate":"new Date(2010, 07, 20)"}

JSONObject obj = new JSONObject();
   consultas = "SELECT CONVERT(VARCHAR (24), fecha, 103) "
                +"FROM kalendario_entradaz "
                + "WHERE activo = 0";
    rs = MBD.SQLBD(consultas);
    while (rs.next())
    {
        x++;
    }
    MBD.desconectarBD();

    out.print("["); 

    consultas = "SELECT CONVERT(VARCHAR (24), fecha, 103) "
                +"FROM kalendario_entradaz "
                + "WHERE activo = 0";
    y = 1;

    rs = MBD.SQLBD(consultas);
    while (rs.next())
    {

            fecha = rs.getString(1);
            dia=fecha.substring(0, 2);
            mes=fecha.substring(3, 5);
            anio=fecha.substring(6, 10);


            obj.put("startDate", "new Date("+anio+", "+mes+", "+dia+")");
            obj.put("endDate", "new Date("+anio+", "+mes+", "+dia+")");


        y++;

        if (y < x)
        {
            out.print(obj+","); 
        }
        else
        {
            out.print(obj); 
        }

    }
        MBD.desconectarBD();

I have read that as such I can not generate the new Date () but I have to parse

    
asked by David Melo 17.04.2018 в 18:26
source

0 answers