Get database dates, and "Highlight" them in a Jquery Calendar

0

I have a code with two dates that will mark something, such as a one week event for example, one is the start date of the event and the other the closing date of that event, to make it easier to view the user I want I put these two dates in a calendar (Datepicker), however I have no idea how to do to show the start date and end date in my calendar, how can I do this? Home Here he is picking up the dates and displaying them in the table along with some other values

 <?php
                include 'phpfiles/connect.php';

                $sql = "SELECT Campanha, DATE_FORMAT( Data_inicio, '%d/%m/%Y' ) AS Data_inicio, DATE_FORMAT( Data_fim, '%d/%m/%Y' ) AS Data_fim, Thumbnail, Descricao FROM walldata limit 0,10";
                $result = $con->query($sql);

                if ($result->num_rows > 0) {
                    while ($row = mysqli_fetch_assoc($result)) {
                        ?>
                        <tbody>       
                            <tr>
                                <td><?= $row['Campanha'] ?></td>
                                <td><?= $row['Data_inicio'] ?></td>
                                <td><?= $row['Data_fim'] ?></td>
                                <td><?= $row['Thumbnail'] ?></td>
                                <td>
                                    <a class="btn btn-primary btn-sm" href="phpfiles/edit.php?Campanha=<?= $row['Campanha'] ?>">Edit</a>
                                    <a class="btn btn-danger btn-sm" href="phpfiles/Delete.php?Campanha=<?= $row['Campanha'] ?>" onclick="return confirm('Tem certeza que deseja deletar esse registro?');">Delete</a>
                                </td>

                            </tr>
                        </tbody>
                        <?php
                    }
                }
                ?>  
And here's the calendar (I picked it up from the internet because I do not know it very well) I can see the days selected, that's how I wanted it to be, it's like date 1 was day 1 and day 2 was day 4, you see?
<html>
    <head>
        <meta charset="utf-8" />
        <title>Calendário jQuery</title>   

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.2.js"></script><scriptsrc="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>

<script>
$(function() {
    $("#calendario").datepicker({
        dateFormat: 'dd/mm/yy',
        dayNames: ['Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado','Domingo'],
        dayNamesMin: ['D','S','T','Q','Q','S','S','D'],
        dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb','Dom'],
        monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
        monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez']
    });
});
</script>
    </head>
    <body>
        <p>Data: <input type="text" id="calendario" /></p>
    </body>
</html>
    
asked by anonymous 09.06.2016 / 13:59

1 answer

1

For these cases I use the Datepicker Range , since you already use Datepicker, I believe you will have no problem.

Here has a more beautiful version of it.

    
09.06.2016 / 14:16