CREATE TRIGGER cus_info_tbl_tr after INSERT on CUS_INFO_TBL
For each ROW
INSERT into Summary_tbl (' school_id ', ' province_id ', ' city_id ', ' Year ', ' Month ', ' Day ', ' hour ', ' minute ', ' first_time ', ' Intdate ') VALUES
(NEW.SCHOOL_ID,
NEW.PROVINCE_ID,
NEW.CITY_ID,
Year (New.date_call),
MONTH (New.date_call),
DayOfMonth (New.date_call),
HOUR (New.date_call),
MINUTE (New.date_call),
New.first_time,
Unix_timestamp (New.date_call) +28800
);
See, in this time stamp and then add 8 hours of seconds on the finish, hehe.
But when I was in Google, I noticed that a lot of brothers reacted Unix_timestamp and PHP mktime the same value, but I have a problem here, and I haven't been able to find out why now.
| The code is as follows |
Copy Code |
Unix_timestamp (), Unix_timestamp (date) |
If no parameters are invoked, a UNIX timestamp (the number of seconds after the ' 1970-01-01 00:00:00 ' GMT) is returned as an unsigned integer. If you call Unix_timestamp () with date, it returns the value of the parameter as the number of seconds after the ' 1970-01-01 00:00:00 ' GMT. Date can be a date string, a DateTime string, a timestamp, or a number in the YYMMDD or YYYMMDD format of a local time.
Inquire
Application comparison of Unix_timestamp () function in MySQL
Application:
| The code is as follows |
Copy Code |
SELECT ( Unix_timestamp (Endtime)-unix_timestamp (startime) )/31536000year,id,name Fromtestime limit0,30 |
Here we can use
From_unixtime (Unix_timestamp), From_unixtime (Unix_timestamp,format) to format a unix_timestamp () timestamp, which will return ' YYYY-MM-DD HH: The Unix_timestamp parameter of the Mm:ss ' or YYYYMMDDHHMMSS format value is expressed in the form of whether the function is used in a string or in a digital context.
If format is already given, the format of the result depends on the format string. The format can contain the same descriptor as the Date_format () function entry list.
| The code is as follows |
Copy Code |
Mysql> Select from_unixtime (875996580); -> ' 1997-10-04 22:23:00 ' Mysql> Select From_unixtime (875996580) + 0; -> 19971004222300 Mysql> Select From_unixtime (Unix_timestamp (), -> '%Y%d%m%h:%i:%s%x '); -> ' 2003 6th August 06:22:58 2003 ' |
In PHP: Time ()
Time--Returns the current Unix timestamp
Strtotime () can also convert Unix timestamp