Skip to content

Instantly share code, notes, and snippets.

@apoorva-shah
Last active July 14, 2018 06:58
Show Gist options
  • Save apoorva-shah/64019dc8445c4f756644b9a98de70b2e to your computer and use it in GitHub Desktop.
Save apoorva-shah/64019dc8445c4f756644b9a98de70b2e to your computer and use it in GitHub Desktop.
php date time
<?php
$date = '2018-03-01';
$end = '2018-09-' . date('t', strtotime($date)); //get end date of month
?>
<table>
<tr>
<?php while(strtotime($date) <= strtotime($end)) {
$day_num = date('d', strtotime($date));
$day_name = date('l', strtotime($date));
$month = date('M', strtotime($date));
$year = date('y', strtotime($date));
$week = date('W', strtotime($date));
$date = date("Y-m-d", strtotime("+1 day", strtotime($date)));
echo "<tr><td>$week - $day_num - $day_name - $month - $year</td></tr>";
}
?>
</tr>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment