php時間戳常用

2021-07-30 09:25:14 字數 764 閱讀 7138

昨天0時時間戳

$yesterday_zero = strtotime(date('y-m-d')) - 3600 * 24;

昨天此時時間戳

$yesterday_now = strtotime('-1 day');

本周一時間戳

$week_this_monday = strtotime('last monday');

明天時間戳

$tomorrow = strtotime("+1 day");

上週一時間戳

$week_last_monday = strtotime('last monday') - 3600 * 24 * 7;

上週日時間戳

$week_last_sunday = strtotime('last monday') - 3600 * 24;

本月第一天時間戳

$month_first = strtotime(date("y") . "-" . date("m") . "-1");

本月最後一天時間戳

$month_last = strtotime(date("y") . "-" . date("m") . "-" . date("t"));

獲取上個月第一天及最後一天

echo date('y-m-01', strtotime('-1 month'));

echo "

"; echo date('y-m-t', strtotime('-1 month'));

php常用的時間戳

strtotime now strtotime today strtotime tomorrow strtotime yesterday strtotime date y m d strtotime 1 day strtotime tomorrow time strtotime 2009 1 22 ...

php 增加時間戳 php如何新增時間戳

php新增時間戳的方法 可以利用mktime 函式來新增。該函式返回乙個日期的unix時間戳,如果錯誤則返回false。具體使用方法如 mktime 0,0,0,date m date d 1,date y mktime 函式返回乙個日期的 unix 時間戳,如果錯誤則返回 false。語法 mkt...

php時間戳累加 php時間戳增加時間的方法

php時間戳增加時間的方法 首先建立乙個php示例檔案 然後通過 strtotime 1 year 方法將當前時間戳增加一年的時間 最後輸出增加後的結果即可。php當前時間戳增加時間 php將當前時間戳增加一年 year echo strtotime 1 year 返回時間戳,如果要轉換成一般時間格...