The blog calendar implementation code in php shares a blog calendar implementation code in php. it is very easy to query the database, as long as you modify the field name to be the same as that in your database, the instance code is as follows:
Function calendarnew ($ starttime = 0 ){
Global $ db, $ tablepre, $ timestamp, $ site_timeoffset, $ site_dateformat, $ curtime;
$ Starttime = $ starttime? $ Starttime: $ timestamp;
$ Curtime = gmdate ($ site_dateformat, $ starttime + $ timeoffset *
The following is the implementation code. if you forget where the code was obtained, it may be Discuz! The personal space is now posted to share with you the following implementation code. if you forget where to find the code, it is probably Discuz! In the personal space
Now post it for everyone to share
Function calendarnew ($ starttime = 0 ){
Global $ db, $ tablepre, $ timestamp, $ site_timeoffset, $ site_dateformat, $ curtime;
$ Starttime = $ starttime? $ Starttime: $ timestamp;
$ Curti
Cookie is used to store information in the client browser. We can use cookies to record user-related information. For example, the webmaster's statistical code is implemented based on cookies and ip addresses, the following describes how to use and pay attention to cookies.
PHP cookie usage
The Code is as follows:
Copy code
Setcookie ('mycooker', 'value ');// Function prototype: int setcookie (string name, string value, int expire, string path, string domain, int secure)E
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 |
method to set the cookie is as follows: the cookie value set in the original php method // setcookie ("user_id", $ user_info ['User _ id'], 86500); // setcookie ("username ", $ user_info ['username'], 86500); // setcookie ("password", $ user_info ['password'], 86500 ); // echo $ _ COOKIE ['username']; // method 2 for cookie setting: use the input class library of the CI framework $ this-> input-> set_cookie ("username ", $ user_info ['username'], 3600
automatically identified and sent to it for information. if it is a stranger, the user will be told to register first. Follow the information below to create a small data database: first name, last name, email address, and counter ).
Follow these steps to create a table:
Mysql> create database users;
Query OK, 1 row affected (0.06 sec)
Mysql> use users;
Database changed
Mysql> create table info (FirstName varchar (20), LastName varchar (40 ),
Email varchar (40), count varchar (3 ));
Query OK
C # compile a review of the automatic shutdown ProgramFirst, the first element of a program is that you can set the program ICON in the settings of the logo and set it in the ICON. The ICON can be downloaded from the Internet. These are the Button controls of the Buton, Label, Timer, and Notiflcon controls involved in the surface kung fu program. You can design the click events as follows:
Private void timereffectick (object sender, EventArgs e) {Int32 time_now; Int32 extra; if (Flag_True = 1) {
-category yes;
// Print category name
Print-severity yes;
// Print severity level
/*
* Note that debugging must have been turned on either
* On the command line or with a signal to get debugging
* Output (non-debugging output will still be written
* This channel ).
*/
};
/*
* If you don't want to see "zone XXXX loaded" messages but do
* Want to see any problems, you cocould do the following.
*/
Channel no_info_messages {
Syslog;
Severity notice;
};
Category load {no_info_messages ;};
/*
* You c
(0.06 sec)
Mysql> use users;
Database changed
Mysql> create table info (FirstName varchar (20), LastName varchar (40 ),
Email varchar (40), count varchar (3 ));
Query OK, 0 rows affected (0.05 sec)
Now we have a qualified table. we can create a php page to check cookies against the database.
######################## Index. php ##################################
$ Info = explode ("", $ Example );
$ FirstName = $ info [0];
$ LastName = $ info [1];
$ Email = $ info [2];
$ Count = $ info [3];
interval = Nextday.timeintervalsincenow;NSLog (@ "%.2f", interval); 3. Calculate the time interval for two points of time timeintervalsincedate:Nstimeinterval Interval2 = [date timeintervalsincedate:nextyear];NSLog (@ "%.2f", Interval2); Timestamp concept: A time interval from 1970.1.1, which is in seconds, called a timestamp the method of time stamp: timeIntervalSince1970Nstimeinterval INTERVAL3 = [date timeIntervalSince1970];NSLog (@ "%.2f", INTERVAL3); Convert a timestamp to a time obje
users;
Database changed
Mysql> CREATE TABLE info (FirstName varchar), LastName varchar (40),
Email varchar (+), Count varchar (3));
Query OK, 0 rows affected (0.05 sec)
OK, now that we have a table that meets the requirements, we can build a PHP page to check cookies against the database.
####################### #index. php##################################
$info = Explode ("", $Example);
$FirstName = $info [0];
$LastName = $info [1];
$email = $info [2];
$count = $info [3];
$count + +;
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.