Created
May 17, 2022 12:59
-
-
Save aditnanda/43622098c07a657c0533a8eb45ee0277 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 1. Untuk menghitung hari senin dalam 1 bulan | |
| function total_sun($month,$year) | |
| { | |
| $sundays=0; | |
| $total_days=cal_days_in_month(CAL_GREGORIAN, $month, $year); | |
| for($i=1;$i<=$total_days;$i++) | |
| if(date('N',strtotime($year.'-'.$month.'-'.$i))==7) | |
| $sundays++; | |
| return $sundays; | |
| } | |
| echo total_sun(11,2016); | |
| 2. Untuk menghitung banyak hari dalam 1 bulan | |
| $tahun = 2022; | |
| $bulan = 02; | |
| $last_date = date('t', strtotime($tahun.'-'.$bulan.'-01')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment