Starting January 1, 2000, "Three days fishing, two days" count, for any day to fight fishing or drying nets? What to do with it

Source: Internet
Author: User

Starting January 1, 2000, "Three days fishing, two days" count, for any day to fight fishing or drying nets?
Starting January 1, 2000, "Three days fishing, two days" count, for any day to fight fishing or drying nets?

------Solution--------------------
PHP Code
  
  ------Solution--------------------
Write a function.

PHP Code
function GetText ($day) {    $nowDay = date ("Z", Strtotime ($day)) + 1;    Return ($nowDay%5 >= 1 && $nowDay%5 <=3)? ' Sun nets ': ' Fishing ';} echo GetText (' 2011-01-01 ');
------Solution--------------------
The calculation is not allowed because the number of days difference calculation error

Give the most stupid method for your reference. Aren't you doing your homework?

$t = Strtotime (' 2000-1-1 ');
$i = 0;
while ($t < time ()) {
echo Date (' y-m-d ', $t). ' '. ($i < 3? ' Fishing ': ' Sun net '). Php_eol;
$t = Strtotime (' +1 Day ', $t);
$i = ($i + 1)% 5;
}
  • 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.

    Tags Index: