PHP確定當月天數

2021-07-12 07:22:34 字數 827 閱讀 2545

<?php echo'本月有'.date('t',time()).'天

';//28天 ?>

date_default_timezone_set('prc'); //預設時區

echo "今天:",date("y-m-d",time()),"

";echo "今天:",date("y-m-d",strtotime("18 june 2008")),"

";echo "昨天:",date("y-m-d",strtotime("-1 day")), "

";echo "明天:",date("y-m-d",strtotime("+1 day")), "

";echo "一周後:",date("y-m-d",strtotime("+1 week")), "

";echo "一周零兩天四小時兩秒後:",date("y-m-d g:h:s",strtotime("+1 week 2 days 4 hours 2 seconds")), "

";echo "下個星期四:",date("y-m-d",strtotime("next thursday")), "

";echo "上個周一:".date("y-m-d",strtotime("last monday"))."

";echo "乙個月前:".date("y-m-d",strtotime("last month"))."

";echo "乙個月後:".date("y-m-d",strtotime("+1 month"))."

";echo "十年後:".date("y-m-d",strtotime("+10 year"))."

";

計算當月天數

let dayarr let date newdate this.year date.getyear this.month date.getmonth 1 當月第一天星期幾 let firstday newdate this.year this.month 1 1 getday 當月天數 個月天數,...

js 獲取當月天數

vardate1 moment format yyyy vardate2 moment format mm varnum newdate parseint date1 parseint date2 0 getdate vardate1 newdate getfullyear vardate2 new...

ORACLE根據日期獲取當月的天數

create or replace function get days p date date return number authid current user asp days number 0 begin select to date to char add months p date,1 y...