PHP program that prints every date from your birthday to three months
after. On the 1st of each month, write the month name. Write “Free
lunch” next to fridays and on dates where the day number is multiple of
five print “Casual” next to the day {Day Name}.
Sample Section of Output
18 Mar 1986
19 Mar 1986
20 Mar 1986 - Casual Thursday
21 Mar 1986 - Free lunch
22 Mar 1986
23 Mar 1986
24 Mar 1986
25 Mar 1986 - Casual Tuesday
26 Mar 1986
27 Mar 1986
28 Mar 1986 - Free lunch
29 Mar 1986
30 Mar 1986 - Casual Sunday
31 Mar 1986
1 Apr 1986
Sample Section of Output
18 Mar 1986
19 Mar 1986
20 Mar 1986 - Casual Thursday
21 Mar 1986 - Free lunch
22 Mar 1986
23 Mar 1986
24 Mar 1986
25 Mar 1986 - Casual Tuesday
26 Mar 1986
27 Mar 1986
28 Mar 1986 - Free lunch
29 Mar 1986
30 Mar 1986 - Casual Sunday
31 Mar 1986
1 Apr 1986
format("d M Y"); $get_day = date('d M Y', strtotime($get_day)); $day_of_month = date('d', strtotime($get_day)); $toChecksat = date('D', strtotime($get_day)); if ($day_of_month == '01') { $first_date_of_month = new DateTime($get_day); echo $first_date_of_month->format('F') . "
"; echo $all = $date->format("d M Y") . "
"; } else { if ($toChecksat == 'Sat') { //Check for SATURDAY echo $all = $date->format("d M Y") . " - Free lunc" . "
"; } else if (($day_of_month % 5) == 0) { //devided by 5 $full_day_name = new DateTime($get_day); echo $all = $date->format("d M Y") . " - Casual " . $full_day_name->format('l') . "
"; } else { echo $all = $date->format("d M Y") . "
"; } } } ?>
No comments:
Post a Comment