PHP displays the start and end timestamps of today, this month, last month, and this year

Source: Internet
Author: User
Tags echo date

Introduction: This is a PHP detailed page showing the start and end timestamps of today, this month, last month, and this year. It introduces the knowledge, skills, and experience related to PhP, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 336637 'rolling = 'no'>
PHP displays the start and end timestamps of today, this month, last month, and this year

$ T = time ();

$ T1 = mktime (0, 0, 0, date ("M", $ T), date ("D", $ T), date ("Y", $ t ));

$ T2 = mktime (0, 0, 0, date ("M", $ T), 1, date ("Y", $ t ));

$ T3 = mktime (, 0, date ("M", $ t)-, date ("Y", $ t ));

$ T4 = mktime (0, 0, 0, 1, 1, date ("Y", $ t ));

$ E1 = mktime (23, 59, 59, date ("M", $ T), date ("D", $ T), date ("Y", $ t ));

$ E2 = mktime (23, 59, 59, date ("M", $ T), date ("T"), date ("Y", $ t ));

$ E3 = mktime (23, 59, 59, date ("M", $ t)-1, date ("T", $ T3), date ("Y ", $ t ));

$ E4 = mktime (, 31, date ("Y", $ t ));

// Test

Echo date ("current y-m-d h: I: s", $ T). "$ T <br> ";

Echo date ("Today's start point y-m-d h: I: s", $ T1). "$ t1 <br> ";

Echo date ("starting point y-m-d h: I: s", $ T2). "$ t2 <br> ";

Echo date ("starting from last month y-m-d h: I: s", $ T3). "$ T3 <br> ";

Echo date ("starting from Y-m-d h: I: s", $ T4). "$ t4 <br> ";

// Test

Echo date ("end today y-m-d h: I: s", $ E1). "$ E1 <br> ";

Echo date ("end of this month y-m-d h: I: s", $ E2). "$ E2 <br> ";

Echo date ("last month end y-m-d h: I: s", $ E3). "$ E3 <br> ";

Echo date ("End of this year Y-m-d h: I: s", $ E4). "$ E4 <br> ";

Result:

Currently 15:42:55 1306222975

Starting from 00:00:00 1306166400

Starting from 00:00:00 1304179200

Starting from last month 00:00:00 1301587200

Starting from 00:00:00 this year, 1293811200

End of today: 23:59:59 1306252799

End of this month: 23:59:59 1306857599

Last month's endpoint 23:59:59 1304179199

End of this year 23:59:59 1325347199

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/336637.html pageno: 10.

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.