PHP returns the start timestamp of the current year, month, and day, And the start timestamp of the next year, month, and day. The current Start Time
1. timestamp of the current year
2. timestamp of the current month
3. Current day Timestamp
4. Start timestamp of next year
5. Start timestamp of next month
6. Start timestamp of tomorrow
7. Current Timestamp
Function Code:
/*** Obtain the timestamp * $ Ymd = Y * $ Ymd = m * $ Ymd = d * $ Ymd = NULL current timestamp * $ xia = true whether to remove start timestamp: remove the year start timestamp or next month start timestamp or tomorrow start timestamp */function getTime ($ Ymd = NULL, $ xia = false) {if ($ Ymd = 'y' & $ xia = true) {// return strtotime (date ('y ', time () + 1 ). '-01-01 00:00:00');} else if ($ Ymd = 'y') {// return strtotime (date ('y ', time ()). '-01-01 00:00:00');} else if ($ Ymd = 'M' & $ xia = true) {// remove a monthly start timestamp $ xiayue_nianfen = date ('y', time (); $ xiayue_yuefen = date ('M', time ()); if ($ xiayue_yuefen = 12) {$ xiayue_nianfen + = 1; // if the month is December, then the year of the next month + 1 $ xiayue_yuefen = 1; // if the month is December, then next month = January} else {$ xiayue_yuefen + = 1; // If the month is not December, + 1} return strtotime ($ xiayue_nianfen in the current month. '-'. $ xiayue_yuefen. '-01 00:00:00');} else if ($ Ymd = 'M') {// return strtotime (date ('Y-m ', time ()). '-01 00:00:00');} else if ($ Ymd = 'D' & $ xia = true) {// return strtotime (date ('Y-m-d', time ()). '00:00:00 ') + 86400;} else if ($ Ymd = 'D') {// return strtotime (date ('Y-m-d ', time ()). '00:00:00 ');} else {// get the current timestamp return time ();}}
Call code:
GetTime ('y'); // The timestamp of the current year getTime ('M'); // The timestamp of the current month getTime ('D '); // The current day's timestamp getTime ('y', true); // The next year's timestamp getTime ('M', true ); // next month's timestamp getTime ('D', true); // tomorrow's timestamp getTime (); // current Timestamp