Day of acquisition:SELECT curdate ();Mysql> SELECT curdate ();+------------+| Curdate () |+------------+| 2013-07-29 |+------------+Get the current date:Mysql> Select Now ();+---------------------+| Now () |+---------------------+| 2013-07-29 22:10:4
PHP development Notes Series (3)-date and time ??? The first two articles completed "PHP Development notes series (1)-PDO use" and "PHP Development notes series (2)-string use", today, I will take a look at the date and time processing in PHP and
PHP Development Note Series (iii)-Date and time
??? The first two completed "PHP Development Note Series (i)-pdo use" and "PHP Development Note Series (ii)-string use", today began to study the date and time in PHP and MySQL date and time
The easiest way to do it
The code is as follows
Copy Code
Select To_days (str_to_date (' 12/1/2001 12:00:00 AM ', '%m/%d/%y '))-To_days (Str_to_date (' 11/28/2001 12:00:00 AM ', '%m/%d/%y ')) as a from table1
Welcome to the Linux community forum and interact with 2 million technical staff into mysqlSELECT1997-12-3123: 59: 59 + INTERVAL1SECOND;
Welcome to the Linux community forum and interact with 2 million technical staff> go to mysql SELECT "23:59:59" +
Today I saw the MySQL date function, which is a lot of useful. Here I only stick two parameters that are not easy to remember. (Refer to MySQL 5.1 reference manual)
DATE_ADD (Date, INTERVALExpr Type) DATE_SUB (Date, INTERVALExpr Type)
These
1.1 Get the current date + time (date + times) function: Now ()In addition to the now () function to get the current datetime, MySQL has the following function:Current_timestamp () Current_timestampLocalTime () localtimeLocaltimestamp ()
SQL statement that inserts a table of data, and a specific data (fixed constant) into another sheetInsert into Select Code,0,1,1,1 from Wm_jobpointINSERT into SELECT from Wm_county pThe fields that are inserted here and the fields of the query
To create a table:The code is as follows:CREATE table if not exists t(ID int,Addtime datetime default ' 0000-00-00 00:00:00′)Add two initial data:Insert T VALUES (1, ' 2012-07-12 21:00:00′);Insert T VALUES (2, ' 2012-07-22 21:00:00′);Data inserted
1.1 Get the current date + time (date + times) function: Now ()In addition to the now () function to get the current datetime, MySQL has the following function:Current_timestamp () Current_timestampLocalTime () localtimeLocaltimestamp ()
1.1 Get the current date + time (date + times) function: Now ()In addition to the now () function to get the current datetime, MySQL has the following function:Current_timestamp () Current_timestampLocalTime () localtimeLocaltimestamp ()
SQL statement, mysql database, SQL statement mysql
SQL statement to insert data in one table and specific data (fixed constants) into another table
insert into wm_jobpoint_allstatus(CODE,pointstatus,housestatus,roomstatus,workstatus) select code,0,1,
1. Date Time function
Time Conversion second function: Time_to_sec
Mysql> Select Time_to_sec (' 01:01:01 ');+-------------------------+| Time_to_sec (' 01:01:01 ') |+-------------------------+| 3661 |+-------------------------+1 row in Set (0.00
Localtimestamp () LocaltimestampThese date-time functions are equivalent to now (). Since the now () function is short and easy to remember, it is recommended that you always use now () instead of the functions listed above.1.2 Get the current date +
1.1 Get the current date + time (date + times) function: Now ()In addition to the now () function to get the current date time, MySQL has the following functionCurrent_timestamp () current_timestampLocalTime () localtimeLocaltimestamp ()
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.