different months$ Mm = $ math; // The total number of different months$ D = (mktime (0, 0, 0, $ m2, $ d2, $ y2)-mktime (0, 0, 0, $ m2, $ d1, $ y2 )) /86400;If ($ d $ M-= 1;$ D + = date ('J', mktime (0, 0, 0, $ m2, 0, $ y2 ));}$ M Return array ($ y, $ m, $ d, $ mm );}Calculated by day, hour, and second
$ One = strtotime ('2017-12-08 07:02:40 '); // start time stamp$ Tow = strtotime ('2017-12-25 00:00:00 '); // End Time Stamp$ Cle = $ tow-$ one; // get the timestamp difference/* This is just a pr
Instance code for month difference between two times:
The code is as follows
Copy Code
$yourdate = "2012-10-20";$yourdate _unix=strtotime ($yourdate);Echo (Date ("Y", $yourdate _unix)-date ("Y")) *12+ (date ("M", $yourdate _unix)-date ("M"));
Example 1
The code is as follows
Copy Code
/** Calculates month difference for 2 time periods* @param $st start time $et end time (timestamp format)* @return The difference $total return*/f
Instance code for month difference between two times:
The code is as follows
$yourdate = "2012-10-20";$yourdate _unix=strtotime ($yourdate);Echo (Date ("Y", $yourdate _unix)-date ("Y")) *12+ (date ("M", $yourdate _unix)-date ("M"));
Example 1
The code is as follows
/** Calculates month difference for 2 time periods* @param $st start time $et end time (timestamp format)* @return The difference $total return*/function Getmonthnu
We sometimes encounter more specific needs when doing a site, a message is a few days and days or one months ago, the last time you do an app ran into this week, leaving the code used at that time do not need to run around.
PHP Code:
function Calctime ($time){$now = time (); Current time$add = Strtotime ($time); Convert time to time stamp$str = ";$timeSpan = $now – $add;$days = Floor ($timeSpan/(24 * 3600 * 1000)); Calculate the difference between d
Tags: combining color ble ber SQL implementation DESC Query UnionHere we share the usage of federated queries.MySQL uses Union and Union All to implement a federated query of the data.Suppose you have the following two tables: mysql> SELECT * from the staff; +----+----------+-------+| ID | name | Slary |+----+----------+-------+| 1 | guoding | 3200 | | 2 | Dingtao | 2800 | | 3 | Haofugui | 3500 | | 4 | guoming | 4000 | | 5 | Haotian | 2900 | | 6 | Fengfei | 3200 | | 7 | guoting |
Create a Cookie array based on PHP. Create: Copy the code as follows: setcookie (ICNet [Reg], thisregcookie, time () + 3600); setcookie (ICNet [Active], Thisislogincookie ., time () + 3600); print_r ($ _ COOKI
Create:
The code is as follows:
Setcookie ("ICNet [Reg]", "This is reg cookie", time () + 3600 );Setcookie ("ICNet [Active]", "This is login cookie.", tim
difference /* This is just a promptEcho ceil ($ cle/60); // The total number of minutesEcho ceil ($ cle/3600); // calculates the total number of hoursEcho ceil ($ cle/3600/24); // returns the total number of days*//* Ceil () function, which is an integer in the next Method */$ D = cell ($ cle/3600/24 );$ H = cell ($ cle % (3
difference.Return $ total;}
Example 2
The code is as follows:
$ One = strtotime ('2017-05-08 07:02:40 '); // start time stamp$ Tow = strtotime ('2017-12-25 00:00:00 '); // end time stamp$ Cle = $ tow-$ one; // Get the timestamp difference /* This is just a promptEcho ceil ($ cle/60); // The total number of minutesEcho ceil ($ cle/3600); // calculates the total number of hoursEcho ceil ($ cle/
Add the php code for the calendar in the blog. Do you want to add a calendar to your blog by adding the php code for adding a calendar? Blue1000 is here to share with you a simple PHP blog calendar implementation code. if you need it, refer to the php code for adding a calendar in a blog.
Do you want to add a calendar in your blog? Blue1000 is here to share with you a simple PHP blog calendar implementation code. if you need it, please refer to it. it is very easy to query the database, you jus
Copy CodeThe code is as follows:
echo Mktime (11,25,0,9,5,2010);//the same as time
Echo Microtime ();
echo Mktime (0,0,0,1,1,1970);
?>
The output is 1283657290, 1283657100, 0.88533200 1283657290, 25200, respectively. From the last value, we know that the timestamp returned here is time-zone adjusted, that is, my January 1, 1970 in China 0 o'clock, Greenwich has not reached 0 points, so the time here will be negative and the whole good equals -8*3600
, select register from the navigation menu in the upper right corner, and enter the information as prompted to complete registration. After successful registration, return to the home page to log on.After logging on, you will see a box for adding a new domain name. Enter naizhao (do not enter www. In addition, the example in this article is naizhao.com), select. com on the right, and click Add.
After the domain name is added, the system automatically jumps to the newly added domain name manageme
ceil ($cle/60); How many minutes.echo ceil ($cle/3600); How many hours?Echo ceil ($cle/3600/24); How many days*//*ceil () function, that is, into a method to take the whole * *$d = cell ($cle/3600/24);$h = cell (($cle% (3600*24))/3600); % take-up$m = cell (($cle% (
the proxy database to keep the proxy database light? We recommend that you keep it by default.# Housekeepingfrequency = 1### Option: maxhousekeeperdelete# The table "Housekeeper" contains "tasks" for housekeeping procedure in the format:# [Housekeeperid], [tablename], [field], [value].# No more than 'maxhousekeeperdelete' rows (corresponding to [tablename], [field], [value])# Will be deleted per one task in one housekeeping cycle.# Sqlite3 does not use this parameter, deletes all corresponding
JS implementation a few minutes ago, a few hours ago, a few days ago, and a few minutes later, a few hours later, a few days before and after /** * Compare incoming timestamps to the current time, calculate a few ago, hours ago, days ago, and minutes, hours, days and weeks before and after * Unixtime need to calculate the timestamp, reserved to the second **/ functionGetdatetimeformat (unixtime) {varCurrtime = Date.parse (NewDate ());; varTime = ((parseint (currtime)/1000)-parseint (Unixti
Copy Code code as follows:
echo Mktime (11,25,0,9,5,2010);
Echo Microtime ();
echo Mktime (0,0,0,1,1,1970);
?>
This output is 1283657290, 1283657100, 0.88533200 1283657290, and-25200 respectively. From the last value, we know that the timestamp returned here is adjusted by the time zone, which is my January 1, 1970 0 o'clock in China, Greenwich is not yet 0, so the time here will be negative and the whole is equal to -8*3600.
L
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.