Functions
WebDev/*nix assorted functions & hacks
Search
find all
Array
-
Bash
-
Classes
-
Config
-
DateTime
-
Debug
-
dotjs
-
File
-
foooo
-
Git
-
HTML
-
Images
-
Javascript
-
Linux
-
Math
-
Misc
-
MySQL
-
OS X
-
Reading
-
Redis
-
Shell scripts
-
snippets
-
SQL
-
Strings
-
TextMate
-
Web
-
\(^o^)/ Fun!
-
_Misc hacks
-
_Pages
foooo
* Readme
calendaring thing
form thing for testing stuff
Web-viewer for curl
4
found
auth
Name:
Category: foooo
Body:
/* A start.. displays a table for the current month, including the last bit of previous and the first bit of next month. Also, function mkt($y, $m, $d). */ echo '<PRE>'; list($y, $m, $d) = explode(' ', date('Y m d')); $fday = mkt($y, $m, 1); // first day $fday_week_index = date('w', $fday); // first day day-of-week (zero and sunday based..) $lday = mkt($y, $m+1, 0); // last day $month_days = range(1, date('d', $lday)); if ($fday_week_index > 1) { $month_days = array_merge(range(2-$fday_week_index, 0), $month_days); } if (count($month_days)%7 != 0) { $lastday = date('d', $lday); $month_days = array_merge($month_days, range($lastday + 1, $lastday + (7 - count($month_days)%7))); } echo "<table border='1'><tr>"; foreach($month_days as $i => $day) { echo "<td>"; echo date('l ('.$day.')<\b\r> Y m d', mkt($y, $m, $day)); echo '</td>'; if ($i && (($i+1)%7==0) && (count($month_days) > $i+1)) echo "</tr><tr>"; } echo "</tr></table>"; function mkt($y, $m, $d) { return mktime(0, 0, 0, $m, $d, $y); }
Footer