कैलेंडर समारोह - सीएसएस-ट्रिक्स

Anonim
 "; $calendar .= "$monthName $year"; $calendar .= ""; // Create the calendar headers foreach($daysOfWeek as $day) ( $calendar .= "$day"; ) // Create the rest of the calendar // Initiate the day counter, starting with the 1st. $currentDay = 1; $calendar .= ""; // The variable $dayOfWeek is used to // ensure that the calendar // display consists of exactly 7 columns. if ($dayOfWeek > 0) ( $calendar .= " "; ) $month = str_pad($month, 2, "0", STR_PAD_LEFT); while ($currentDay <= $numberDays) ( // Seventh column (Saturday) reached. Start a new row. if ($dayOfWeek == 7) ( $dayOfWeek = 0; $calendar .= ""; ) $currentDayRel = str_pad($currentDay, 2, "0", STR_PAD_LEFT); $date = "$year-$month-$currentDayRel"; $calendar .= "$currentDay"; // Increment counters $currentDay++; $dayOfWeek++; ) // Complete the row of the last week in month, if necessary if ($dayOfWeek != 7) ( $remainingDays = 7 - $dayOfWeek; $calendar .= " "; ) $calendar .= ""; $calendar .= ""; return $calendar; ) ?>

प्रयोग

मई 2005 की एक तालिका को मुद्रित करने के लिए, बस करें:

और आपको इस तरह एक टेबल मिलेगा:

मई 2005
रों टी डब्ल्यू टी एफ रों
1
१० 1 1 १२ १३ १४
१५ १६ १। १। १ ९ २० २१
२२ २३ २४ २५ २६ २। २।
२ ९ ३० ३१