PHP computing time period is the day of the week, the number of days after the current time and the time difference between the date _ PHP Tutorial

Source: Internet
Author: User
The PHP computing time period is the day of the week, the day after the current time and the time difference between the date. These time functions have been released. you don't need to use them! If you have any questions, you can leave a message below. I will reply in time to make friends ~ The following code copies all these time functions. you don't need to use them! If you have any questions, you can leave a message below. I will reply in time to make friends ~
The code is as follows:


// Get the difference in days between two dates
Function SubDay ($ ntime, $ ctime)
{
$ Dayst = 3600*24;
$ Cday = ceil ($ ntime-$ ctime)/$ dayst );
Return $ cday;
}
// Obtain the number of days after the current time. the unit for increasing the number of days is 1.
Function AddDay ($ ntime, $ aday)
{
$ Dayst = 3600*24;
$ Oktime = $ ntime + ($ aday * $ dayst );
Return $ oktime;
}
// Obtain the day of the week.

Function AddSpeDay ($ day = 0)
{
// $ Day = isset ($ day )? Intval ($ day): 0;
$ Daynum = date ('w')-$ day;
$ Oktime = time ()-(3600*24 * $ daynum );
Return $ oktime;
}

# Method for retrieving the current time in php

// Obtain the current time, in the format of 14:20:35

Function GetDateTimeMk ($ mktime)
{
Return MyDate ('Y-m-d H: I: S', $ mktime );
}

// Obtain the current time in the format of 2009-10-23

Function GetDateMk ($ mktime)
{
Return MyDate ("Y-m-d", $ mktime );
}

?>

Success! If you have any questions, you can leave a message below. I will reply in time to make friends ~ The code is as follows...

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.