-
Notifications
You must be signed in to change notification settings - Fork 2
/
dates.php
28 lines (28 loc) · 681 Bytes
/
dates.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<div style='width:500px;margin:auto'>
<center>
<?php
$from = strtotime('-10 days');
$to = strtotime('+10 days');
while ($from < $to) {
echo date ("Y-m-d", $from) . " - " . strtotime(date ("Y-m-d", $from)) . "<br/>";
$from += 86400;
}
?>
</center>
<br/>
<form>
<label>Timestamp</label>
<input type='text' name='timestamp' />
<label>Date</label>
<input type='text' name='date' />
<input type='submit' />
</form>
<?php
if (!empty($_GET['timestamp'])) {
echo 'Timestamp to date: <strong>' . date('d-m-Y H:i:s', $_GET['timestamp']) . '</strong><br/>';
}
if (!empty($_GET['date'])) {
echo 'Date to timestamp: <strong>' . strtotime($_GET['date']) . '</strong>';
}
?>
</div>