Last active
July 14, 2018 06:58
-
-
Save apoorva-shah/64019dc8445c4f756644b9a98de70b2e to your computer and use it in GitHub Desktop.
php date time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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