PHP code _php instance that gets Nadia and common year days

Source: Internet
Author: User
Copy CodeThe code is as follows:
Gets the number of days in a month that can be used for 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;
}
**
* According to the time stamp to get the corresponding day of the week
*
* @param int $time _stamp timestamp
*/
function Getweek ($time _stamp)
{
$week _num = Date ("W", $time _stamp);
Switch ($week _num)
{
Case "0":
$week = "Day";
Break
Case ' 1 ':
$week = "one";
Break
Case ' 2 ':
$week = "two";
Break
Case ' 3 ':
$week = "three";
Break
Case ' 4 ':
$week = "Four";
Break
Case ' 5 ':
$week = "Five";
Break
Case ' 6 ':
$week = "Six";
Break
}
Return $week;
}

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.