How to Use php to obtain the number of days of every month in the year of the Swiss or the year of the year, the following function:
The Code is as follows:
// Obtain the number of days of a month, which can be used in any month
Function getDays ($ month, $ year)
{
Switch ($ month)
{
Case 4:
Case 6:
Case 9:
Case 11:
$ Days = 30;
Break;
Case 2:
If ($ year % 4 = 0)
{
If ($ year 0 = 0)
{
$ Days = $ year @ 0 = 0? 29: 28;
}
Else
{
$ Days = 29;
}
}
Else
{
$ Days = 28;
}
Break;
Default:
$ Days = 31;
Break;
}
Return $ days;
}
**
* Obtain the day of the week based on the timestamp.
*
* @ Param int $ time_stamp
*/
Function getWeek ($ time_stamp)
{
$ Week_num = date ("w", $ time_stamp );
Switch ($ week_num)
{
Case "0 ":
$ Week = "day ";
Break;
Case '1 ':
$ Week = "1 ";
Break;
Case '2 ':
$ Week = "2 ";
Break;
Case '3 ':
$ Week = "3 ";
Break;
Case '4 ':
$ Week = "4 ";
Break;
Case '5 ':
$ Week = "5 ";
Break;
Case '6 ':
$ Week = "6 ";
Break;
}
Return $ week;
}