0
I have a code with two dates that will mark something, such as a week event for example, one is the start date of the event and the other the end date of this event, to facilitate the user view I want to put these two dates in a calendar (Datepicker)but I have no idea how to show the start and end date in my calendar, have to do this?
Here he is taking the dates and displaying them in table together 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
}
}
?>
<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>
<script src="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>
I am currently using datepicker that picks the date of the pc, da de pegar a dos valores do banco?
– Nikk 17016
But you just want the user to select the dates that are in the start and end date range or you want to leave those dates only highlighted ?
– LucaoA
In fact, he has a record that he will register the event and the duration, these data will be stored in the database, then I want to display in a calendar, the start date and the end date, several at the same time, Worry about validating equal dates at different events I’ll arrange that later.
– Nikk 17016
@Lucaoa Only display dates that are already in the comic book
– Nikk 17016